Compare commits
605 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ffd8eccee | |||
| 157e60247f | |||
| 621bec6af3 | |||
| 6c1e5b1fa4 | |||
| 916108d2c6 | |||
| b499003385 | |||
| 46b62aea09 | |||
| 58b711ed97 | |||
| dbef8b02c3 | |||
| 5553aa421a | |||
| 10587936b9 | |||
| 410802b9af | |||
| b554b516aa | |||
| df7f5d083a | |||
| 7de829b4d7 | |||
| 4819cd5155 | |||
| 2fa94cb2c3 | |||
| 12dc857cdf | |||
| a039a85e44 | |||
| 09e368cffc | |||
| b009d07cdc | |||
| bdaae0b4e2 | |||
| 54acae8036 | |||
| e0d7da80bf | |||
| fcd9b7245e | |||
| e29b7d0b0d | |||
| fc9df1308c | |||
| 1683ab3ca0 | |||
| 56004fd998 | |||
| e4105228a1 | |||
| dc97b03e69 | |||
| 836dcfb173 | |||
| 2424a51918 | |||
| 0dd45e8625 | |||
| 111166cc59 | |||
| 491e980ec6 | |||
| f341455364 | |||
| 61e7b7be21 | |||
| 8e60674835 | |||
| b27e67999b | |||
| 3177fd14f9 | |||
| 9ba41ed6e8 | |||
| 70f2e2e09c | |||
| 56fc8f0077 | |||
| 85abff343e | |||
| 6cefdfeddd | |||
| 75fa51ef6d | |||
| 4181b4b142 | |||
| 7b55d2cf1a | |||
| 03230181ce | |||
| 5e4f692e63 | |||
| e9a046c439 | |||
| 182de7c957 | |||
| 6c939819a3 | |||
| 6288be286f | |||
| 76a13596aa | |||
| c18cd6050b | |||
| 60f5d4c93e | |||
| 03840151ac | |||
| 2e44f3e2ff | |||
| 4f9fd5cf1d | |||
| 59f334622b | |||
| c505a08e46 | |||
| ffae0010c4 | |||
| 6c72a223f5 | |||
| 5a027594c3 | |||
| ebc3600f78 | |||
| ae0cf9ff54 | |||
| 08bf8b7464 | |||
| 0201abca5e | |||
| d87b566c59 | |||
| 572b4140f9 | |||
| 6241471f3e | |||
| 1ae9cdb4c9 | |||
| c1e1b54034 | |||
| f654cb7d3b | |||
| 85beb4fa20 | |||
| a0e81996eb | |||
| ec477ef71d | |||
| 3afc760644 | |||
| ba32140671 | |||
| 91d36dd410 | |||
| 4fd1e32752 | |||
| b538adf2c0 | |||
| d16c9fbaca | |||
| 0274294a6f | |||
| 03b19d8861 | |||
| 171612671f | |||
| d3db28b3f4 | |||
| 896ea5b753 | |||
| 5498b077fd | |||
| 534a9b6ba0 | |||
| cea961f4f4 | |||
| 848c6815d3 | |||
| 46559039f3 | |||
| eb7a42bc13 | |||
| ffe56fe6b3 | |||
| d4ba57fcc3 | |||
| a95c9ebc51 | |||
| 9195c39756 | |||
| e0ffeb8ded | |||
| d9bb434c1f | |||
| 866c83909c | |||
| 4965b7b6fa | |||
| 45f3e86457 | |||
| c033de9b83 | |||
| 3f7f9b705e | |||
| b6d19f4c8b | |||
| 3a2b8f94ec | |||
| 3a5933a519 | |||
| 4c295dc49c | |||
| 03ebb41262 | |||
| b0c3265561 | |||
| 98943b28aa | |||
| c354c5a63d | |||
| 2f8cb9b2d0 | |||
| 7559a87e8a | |||
| b2394691cc | |||
| 5a94004b59 | |||
| 3bd609d77c | |||
| 84d2961a91 | |||
| 3a9f26113f | |||
| 6a240c36ac | |||
| aaf4261969 | |||
| 0211299846 | |||
| aca11d6879 | |||
| 5dceb7f7d2 | |||
| 3372b1a84b | |||
| 75a4eca13a | |||
| 13f0ab881e | |||
| d4b45526b2 | |||
| c06e1f4848 | |||
| 6a4a52d110 | |||
| ed6f5b8755 | |||
| e87b4dca71 | |||
| 567c8b5ab3 | |||
| 7aeca0512c | |||
| 5567934fc9 | |||
| 63bece1fe7 | |||
| ad3c285fc6 | |||
| 47c461b25b | |||
| 97f0aa7875 | |||
| 8e54460a48 | |||
| 4c4d260199 | |||
| b18c6b5781 | |||
| d76e241558 | |||
| 13cbd9fcc7 | |||
| 6e54589d9e | |||
| c781c0ff24 | |||
| 0277e26152 | |||
| 563cce5530 | |||
| b0e4be7fda | |||
| e29701a203 | |||
| 6a1cd87480 | |||
| 3db858b45f | |||
| 49ee69f316 | |||
| b43e0a3423 | |||
| 8054099d0e | |||
| a8e49cc21f | |||
| 5f1ec18550 | |||
| 6b5c5714e5 | |||
| 9a8e5b07ae | |||
| 3f4cf65686 | |||
| 345eca1efe | |||
| 166afbf8e8 | |||
| 9120d1c834 | |||
| 083f9e7723 | |||
| a0cfc6c404 | |||
| edc50c85ef | |||
| 4794bc3db6 | |||
| 2299c02639 | |||
| ae13a82a9a | |||
| 6c88713f82 | |||
| 5c6fedae17 | |||
| 5faa1c3d6e | |||
| 074bcd33be | |||
| 5b6b42b5a9 | |||
| ae8a06cdca | |||
| c9bbf5820b | |||
| bb0b764172 | |||
| ae8e9ef650 | |||
| 8df7ff75bb | |||
| bbfd8e0e89 | |||
| 467212877f | |||
| 204b8857a1 | |||
| a524524ffd | |||
| 3ef1f448a3 | |||
| a5df8f2f35 | |||
| b56a8c7f88 | |||
| 649782b547 | |||
| 97245e9baa | |||
| 0f3c27c8a5 | |||
| 3273637179 | |||
| 1eaa0e9b74 | |||
| 28d1bce2d4 | |||
| b8072d8562 | |||
| da9886d822 | |||
| 747f2e5af6 | |||
| aeb3ee0969 | |||
| e248f1a4b5 | |||
| d23833285e | |||
| ff9fe6857f | |||
| 58f2d3fbe7 | |||
| d9f75581be | |||
| 307efe2172 | |||
| 4ea4dc9176 | |||
| fa25015e8c | |||
| 296b6b1ed5 | |||
| b88fe301be | |||
| ffd836e6f4 | |||
| 457cf66d0d | |||
| 36765745a1 | |||
| 46c19a3d28 | |||
| 6cf928eb6c | |||
| a0d076f01a | |||
| 37c744759c | |||
| 277a05eb8c | |||
| 0376e4668c | |||
| 9d5652de64 | |||
| bb109b5d9e | |||
| d630ddd182 | |||
| e268041a42 | |||
| f9cbeeeedc | |||
| 62542f836f | |||
| 6d4c74fdce | |||
| 3dac4a01c6 | |||
| f598ec00f5 | |||
| 6fc18f4b37 | |||
| 8c9f16fa7a | |||
| 001ca0a982 | |||
| b23c0248ba | |||
| c4c352facc | |||
| 30af6d1159 | |||
| 1fac3fe44e | |||
| 8ac6c08f00 | |||
| 5b62f29b5e | |||
| 817cfb09f8 | |||
| 8da478ab34 | |||
| 8d866c5980 | |||
| 467e622778 | |||
| aa81df921b | |||
| 328020b241 | |||
| 41cd0c6f13 | |||
| db02abe54e | |||
| 447bc18c48 | |||
| 283c66251b | |||
| 63b68d2f5e | |||
| 7e09a5648a | |||
| 4a0b833548 | |||
| 86bec01640 | |||
| b07a2a968d | |||
| 997d553520 | |||
| 8eb05850cb | |||
| 98eaec99ee | |||
| 8fb946f6e8 | |||
| a10670c991 | |||
| 48f347e62b | |||
| ed1c047cf2 | |||
| ea9c2a72d9 | |||
| 15edfe4ffa | |||
| c2698e2be9 | |||
| 0defdc4af5 | |||
| ea9b47f1b6 | |||
| 65c8320a32 | |||
| a7afde2e7d | |||
| a876a829e4 | |||
| f4bd883003 | |||
| 0fcdadc531 | |||
| d58b545ffb | |||
| 8ca299e82b | |||
| a231a2114a | |||
| ab41a549f8 | |||
| a9997a3af6 | |||
| 6d86b16dbe | |||
| 779d32747d | |||
| ffeca06bd6 | |||
| 83b387e782 | |||
| b41fe2e093 | |||
| 93573218d4 | |||
| 076968dc1e | |||
| 5e6cf622e3 | |||
| 90c65e3611 | |||
| afe75aedc2 | |||
| 8b215a453c | |||
| c3329123a3 | |||
| 107ef2017c | |||
| acad180cee | |||
| 504ca9c0c8 | |||
| 2d9f28c0ff | |||
| 07b3e8785c | |||
| 68ef86ac4f | |||
| beb20fb1db | |||
| 3a965088a2 | |||
| 89118ee7ba | |||
| 4b5d503cf0 | |||
| aeac103fbc | |||
| cd153e8a53 | |||
| 5369b07eb0 | |||
| 58f7b966d0 | |||
| 4be1d754b7 | |||
| c1351fb659 | |||
| d8926de40e | |||
| 73c94cf1d6 | |||
| c2a637f68a | |||
| 6a986f03b6 | |||
| a52ae238ab | |||
| 8a0d688a61 | |||
| 3260b8f142 | |||
| dc8e01d469 | |||
| 0105da3238 | |||
| 8979515aa4 | |||
| a8c827455d | |||
| 798edf5300 | |||
| 54758bee1f | |||
| cfe0da1eed | |||
| 1198dc76a4 | |||
| bed3e9918b | |||
| d76bb2991a | |||
| e962e86fcd | |||
| dd59c90842 | |||
| c03720879e | |||
| a62787ebb2 | |||
| 2a7541342c | |||
| f96d6cdb2b | |||
| 3ea6ddd321 | |||
| 17f7d80fcf | |||
| e3437c748a | |||
| f1d80727d0 | |||
| c7fabe2897 | |||
| cc1c3799b6 | |||
| a196bf1132 | |||
| 4bcfeebdea | |||
| 740965016f | |||
| 39e6301f42 | |||
| fd02c885e9 | |||
| 26a2966a7b | |||
| 29cfcbdc97 | |||
| de62ea96ab | |||
| 2d230f79a6 | |||
| cde094a0df | |||
| 2fb3dc8c90 | |||
| f6a8ba0ccb | |||
| f650f96b69 | |||
| c230546a2c | |||
| f3ac0535f8 | |||
| 7ce942d3fb | |||
| 56a8e947df | |||
| f592a303e4 | |||
| e14670d457 | |||
| 0acf9caa8e | |||
| 22860389de | |||
| 16e764b402 | |||
| 85862c4e22 | |||
| eb764d43f8 | |||
| 6b57f596f7 | |||
| cefaec5d6f | |||
| 29b6eab0ea | |||
| 360674f523 | |||
| 7900f91e46 | |||
| e4248503cf | |||
| 168bab34f7 | |||
| 46e7ea8c1e | |||
| 1ce7de0fb8 | |||
| d9a0f3cfe2 | |||
| 200cec3321 | |||
| d4e730db0c | |||
| ca78d845df | |||
| 9ff31dd29b | |||
| 0815359a20 | |||
| 96139a902d | |||
| a6233ac852 | |||
| 4e9ebb5299 | |||
| 585f31fa2e | |||
| 69e7838461 | |||
| 3fe3800b7c | |||
| 491275b444 | |||
| 1cd107d5ab | |||
| 5af2d95bff | |||
| 62f5db06a1 | |||
| e32a12f877 | |||
| 584733f034 | |||
| c3c1819e12 | |||
| 3f36ebc6e7 | |||
| 4aea2d2e09 | |||
| 4e9107d4b1 | |||
| 7d895720be | |||
| 323dde2b10 | |||
| ac16e375c7 | |||
| 31143f9611 | |||
| 7da4844dcc | |||
| c9e4abcd3a | |||
| 6e80fde45f | |||
| d182b133a9 | |||
| 5e3240a32f | |||
| 436989d745 | |||
| f62606105e | |||
| 0f85a40a25 | |||
| 16ad1e428f | |||
| a6e0028899 | |||
| dc3def1afd | |||
| a14e426fb5 | |||
| a1a4026867 | |||
| aff1b88c92 | |||
| dc072f881c | |||
| 824ccfc562 | |||
| 8c6e5ca131 | |||
| a7b69ad9b5 | |||
| 3cd25516ab | |||
| f3c8c5a9c0 | |||
| 6878200ccf | |||
| e1fbd52c29 | |||
| 79c2df8392 | |||
| 0888402cea | |||
| 3dae3205e7 | |||
| 4858122d17 | |||
| a19023277f | |||
| 72dc9e3bf1 | |||
| 5f814cc30a | |||
| 23aafbf09f | |||
| 761dc7cad0 | |||
| f62a873eef | |||
| 03c99ebc99 | |||
| cb339f85b8 | |||
| 5d056eabf6 | |||
| 4e77667ab8 | |||
| d3e3ddf897 | |||
| fca983e81e | |||
| b1995d0d77 | |||
| 8ccfda4972 | |||
| 9a47c0f923 | |||
| b33b679b13 | |||
| 8d41ecff3e | |||
| 85bcf9a366 | |||
| b27e3631f0 | |||
| 4d5ba0631d | |||
| 0f618ae29e | |||
| 13d415f2f6 | |||
| e7b14ae26e | |||
| 07658347a9 | |||
| 0436801a9c | |||
| 4da593a3de | |||
| f5194bbf83 | |||
| 15552e5478 | |||
| d9616c1993 | |||
| 5dbce5ce9b | |||
| 1f47c36e49 | |||
| ed05890740 | |||
| 68d73dcce5 | |||
| 9643a21827 | |||
| 07b64c2f0f | |||
| 3df3ec2a29 | |||
| 0015fda94c | |||
| 589f483e7b | |||
| a77f8c9f62 | |||
| 1d7aa9e40b | |||
| 8de4b04819 | |||
| 175dba86fd | |||
| 767b9b9405 | |||
| 202a51d9e3 | |||
| 3014d36a61 | |||
| d718fda057 | |||
| bbb7b365d5 | |||
| 740e485160 | |||
| 5a69127862 | |||
| 798883f21a | |||
| bec71a15b4 | |||
| c4baf60044 | |||
| d32081401f | |||
| ed119ae246 | |||
| 51768d0e16 | |||
| 6f1a4e5bb9 | |||
| e323d2a93e | |||
| 23922eebf1 | |||
| 92bd85ba30 | |||
| ca7aa30bc5 | |||
| d17972427a | |||
| 25f0c81530 | |||
| 4f95d126ba | |||
| 310196cc59 | |||
| 8052bcc69c | |||
| 04ee41d7b0 | |||
| 23af1cd8ad | |||
| 4426194ee6 | |||
| 92c119e12c | |||
| ff02665407 | |||
| d471ed5912 | |||
| b92ca5da02 | |||
| 0f7c0f616c | |||
| 5551f30400 | |||
| 2c10d72fe5 | |||
| 44fe51247c | |||
| 3a99f1e9f1 | |||
| d233f0ca3e | |||
| c548bdc3fe | |||
| 839d797292 | |||
| f8a30ddfc1 | |||
| bb0eb3af45 | |||
| 999d9bc73b | |||
| 16c7003acb | |||
| f64045c229 | |||
| 58aebc4447 | |||
| 3b3b6036f8 | |||
| 75748f4ae9 | |||
| f90fb68aec | |||
| 4fa3943e51 | |||
| 0a92f741b3 | |||
| a35f8d52d6 | |||
| b08ccc0bec | |||
| 523cd0dff7 | |||
| 8ac1806015 | |||
| 0b2275774f | |||
| 4fbfe9b041 | |||
| b6c848d711 | |||
| a467cfd060 | |||
| f24be8476e | |||
| 904b1815b5 | |||
| d6322c6389 | |||
| 2ee16e5dd9 | |||
| f846315a6a | |||
| 5329b7d211 | |||
| ac18a665d5 | |||
| c492e71aed | |||
| 4ea1319c6b | |||
| 2aac3c2cc9 | |||
| 55d18bdc06 | |||
| abefa0ab00 | |||
| ea28dc8cff | |||
| d3b9eb7fc8 | |||
| cdb61923af | |||
| 070ddcd14b | |||
| 355890b421 | |||
| d86407f263 | |||
| a24a7db72b | |||
| 2096a29b06 | |||
| ce352b5538 | |||
| 4bcd2c75cc | |||
| 3c3bf0192d | |||
| cf84d999d8 | |||
| 668628941e | |||
| 33f8fa331d | |||
| 7814d1fd75 | |||
| b57c3008a3 | |||
| 99d291eb69 | |||
| 8e35398371 | |||
| 3313fd4e2b | |||
| 56c02dd7d1 | |||
| 4e4ed1e2d5 | |||
| 82aa2cb5c2 | |||
| e9944148d5 | |||
| afa4eb7d35 | |||
| 55597d88a4 | |||
| ac37b589b6 | |||
| b9d868b8eb | |||
| 30e5bfcbf0 | |||
| 57e21683a6 | |||
| 852ecf7c20 | |||
| 5976debfcd | |||
| 08fcba63d0 | |||
| 1abe9760ab | |||
| 9a4d8453ed | |||
| b637c3e201 | |||
| 292f54dd60 | |||
| 1328c1409a | |||
| dbeddd4417 | |||
| add5dec4a9 | |||
| 97b51dc070 | |||
| 88c9a30f77 | |||
| 83035c1d4b | |||
| 50c19a6534 | |||
| 5c071cb02e | |||
| 6edb526561 | |||
| ee18156675 | |||
| e70a961ac1 | |||
| ffdc8c8f60 | |||
| fd78bd3eaf | |||
| f2ccba0988 | |||
| 8ee465c630 | |||
| 31b655c9eb | |||
| 7fd65cc3c1 | |||
| 8089222fc3 | |||
| 0667bd39fb | |||
| a4854dfa9e | |||
| 6c54d0a7e2 | |||
| 341860eb4d | |||
| 876445f080 | |||
| 03ef6a7719 | |||
| 2960bb7cb2 | |||
| 161c0f0963 | |||
| 3002591d08 | |||
| 1b2b9726f8 | |||
| a3691d311b | |||
| 89d449352f | |||
| e220e6dae7 | |||
| bd3d1f7715 | |||
| f3ffa99f6a | |||
| 85830c059e | |||
| 6435d5083a | |||
| f0925e4ef2 | |||
| df87b1820b | |||
| 170f099ce1 | |||
| ccc6f7c24e | |||
| 41b21b6634 | |||
| b46a900d71 | |||
| 4fa661b450 | |||
| 4da8d39ec5 |
+4
-2
@@ -26,7 +26,8 @@ variables:
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v49"
|
||||
MESON_TEST_MAX_PROCESSES: 8
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v52"
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
@@ -414,11 +415,12 @@ static-scan:
|
||||
# Run tests with the address sanitizer. We need to turn off introspection
|
||||
# and f16c, since they are incompatible with asan
|
||||
asan-build:
|
||||
image: $FEDORA_IMAGE
|
||||
extends: .build-fedora-default
|
||||
tags: [ asan ]
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
MESON_TEST_MAX_PROCESSES: 4
|
||||
script:
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- CC=clang meson setup
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM fedora:39
|
||||
FROM fedora:40
|
||||
|
||||
RUN dnf -y install \
|
||||
adwaita-icon-theme \
|
||||
@@ -99,8 +99,11 @@ RUN dnf -y install \
|
||||
which \
|
||||
wireplumber \
|
||||
xorg-x11-server-Xvfb \
|
||||
&& dnf -y update \
|
||||
&& dnf clean all
|
||||
|
||||
RUN rm /usr/share/vulkan/icd.d/powervr_mesa_icd.x86_64.json
|
||||
|
||||
# Enable sudo for wheel users
|
||||
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
|
||||
|
||||
|
||||
+10
-4
@@ -8,17 +8,19 @@ builddir=$1
|
||||
setup=$2
|
||||
suite=$3
|
||||
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
|
||||
n_processes=${MESON_TEST_MAX_PROCESSES:-1}
|
||||
|
||||
# Ignore memory leaks lower in dependencies
|
||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
|
||||
export G_SLICE=always-malloc
|
||||
|
||||
case "${setup}" in
|
||||
x11*)
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
dbus-run-session -- \
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--num-processes "${n_processes}" \
|
||||
--print-errorlogs \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
@@ -40,9 +42,11 @@ case "${setup}" in
|
||||
compositor=$!
|
||||
export WAYLAND_DISPLAY=wayland-5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
dbus-run-session -- \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--num-processes "${n_processes}" \
|
||||
--print-errorlogs \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
@@ -63,9 +67,11 @@ case "${setup}" in
|
||||
server=$!
|
||||
export BROADWAY_DISPLAY=:5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
dbus-run-session -- \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--num-processes "${n_processes}" \
|
||||
--print-errorlogs \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
|
||||
@@ -1,6 +1,203 @@
|
||||
Overview of Changes in 4.15.5, xx-xx-xxxx
|
||||
Overview of Changes in 4.16.1, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.16.0, 09-06-2024
|
||||
=========================================
|
||||
|
||||
Note: This release changes the default GSK renderer to be Vulkan,
|
||||
on Wayland. Other platforms still use ngl. The intent of this change
|
||||
is to use the best available platform APIs. You can still override
|
||||
the renderer choice using the GSK_RENDERER environment variable.
|
||||
|
||||
We believe that most of the problems reported with the new renderers
|
||||
during the 4.13 and 4.15 development cycles have been addressed by now.
|
||||
|
||||
But the new renderers and dmabuf support are using graphics drivers
|
||||
in different ways than the old gl renderer, and trigger new driver bugs.
|
||||
Therefore, it is recommended to use the latest mesa release (24.2)
|
||||
with the new renderers.
|
||||
|
||||
* GtkScale:
|
||||
- Fix positioning of scale values
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Make Control-clicks work for the recent section
|
||||
|
||||
* GtkPopover:
|
||||
- Make sure focus lands on the right widget when cascading
|
||||
|
||||
* GtkSpinButton:
|
||||
- Disable Emoji input for numeric spin buttons
|
||||
|
||||
* GtkSingleSelection:
|
||||
- Implement unselect_all
|
||||
|
||||
* Accssibility:
|
||||
- Fix roles for radio buttons
|
||||
- Check if ATs are listening before exporting trees
|
||||
- Add a check for sandboxed accessibility bus
|
||||
- Fix handling of the error message relation
|
||||
- Turn criticals into debug messages
|
||||
- Set expanded states properly in menus
|
||||
|
||||
* CSS:
|
||||
- Fix a few issues on bigendian systems
|
||||
- Avoid a crash with relative colors
|
||||
|
||||
* GSK:
|
||||
- Use the right GL context when exporting textures
|
||||
- Don't let colors influence depth decisions
|
||||
- Allow uploading of mipmap levels when tiling textures
|
||||
|
||||
* GDK:
|
||||
- Update keysyms from libX11 1.8.10
|
||||
- Implement cpu-side mipmapping
|
||||
- Use a thread pool for color conversions and mipmapping
|
||||
|
||||
* Vulkan:
|
||||
- Fix drag surface offsets
|
||||
|
||||
* Wayland:
|
||||
- Fix a crash
|
||||
- Associate EGL windows with context later
|
||||
|
||||
* X11:
|
||||
- Fix initial EGL context creation
|
||||
- Fix a problem with GL context creation
|
||||
|
||||
* Broadway:
|
||||
- Implement compute_size and request_layout
|
||||
|
||||
* MacOS:
|
||||
- Set transparent backgroiund for toplevel windows
|
||||
|
||||
* Windows:
|
||||
- Improve debug output
|
||||
- Detect Mesas d3d12 driver and request GDI compat
|
||||
|
||||
* Demos:
|
||||
- Set window icons in demos
|
||||
- Add a 64k x 64k image to the image scaling demo
|
||||
|
||||
* Translation updates
|
||||
Belarusian
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Czech
|
||||
Galician
|
||||
German
|
||||
Hebrew
|
||||
Indonesian
|
||||
Korean
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.6, 08-26-2024
|
||||
=========================================
|
||||
|
||||
* GtkCheckButton:
|
||||
- Add a grouped style class for radio buttons
|
||||
|
||||
* GtkScale:
|
||||
- Fix alignment and positioning problems
|
||||
|
||||
* Css:
|
||||
- Fix crashes in the variable support
|
||||
|
||||
* Gsk:
|
||||
- Make graphics offloading work better with kwin
|
||||
- Make colorstate transfer functions more robust
|
||||
- GC dead textures more agressively
|
||||
- Only use a single render pass per frame
|
||||
|
||||
* GL:
|
||||
- Round damage rectangles properly
|
||||
- Use the shared context when creating textures
|
||||
- Fix a file descriptor leak in dmabuf export
|
||||
|
||||
* Vulkan:
|
||||
- Round damage rectangles properly
|
||||
|
||||
* Wayland:
|
||||
- Work with the kwin implementation of xx-color-management-v4
|
||||
|
||||
* Windows:
|
||||
- Make gtk_show_uri use SHOpenWithDialog()
|
||||
- Enable incremental rendering with WGL
|
||||
|
||||
* Macos:
|
||||
- Open context menus on Ctrl-left click
|
||||
|
||||
* Debugging:
|
||||
- Show color state information in the inspector
|
||||
- Collect input event traces in the recorder
|
||||
- Add shortcuts for toggling recording: Super-r
|
||||
and for screenshots: Super-c
|
||||
- Split the GDK_DEBUG env var into GDK_DEBUG and GDK_DISABLE
|
||||
- Add GDK_DISABLE=color-mgmt and GDK_DISABLE=offload
|
||||
|
||||
* Tools:
|
||||
- Add a 'Paste as node' action in gtk4-node-editor
|
||||
|
||||
* Translations updates
|
||||
Basque
|
||||
Belarusian
|
||||
Brazilian Portuguese
|
||||
Chinese (China)
|
||||
Georgian
|
||||
Hebrew
|
||||
Hindi
|
||||
Russian
|
||||
Slovenian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.5, 11-08-2024
|
||||
=========================================
|
||||
|
||||
* GtkTextView:
|
||||
- ADd GtkTextBufferCommitNotify
|
||||
|
||||
* CSS:
|
||||
- Propagate color state information to GSK for many features:
|
||||
colors, borders, shadows, text
|
||||
|
||||
* Gdk:
|
||||
- Fix an fd leak in the Vulkan code
|
||||
- Fix a leak of EGLSurfaces and DMA buffers
|
||||
- Set the opaque region of surfaces automatically based on their content
|
||||
|
||||
* Gsk:
|
||||
- Fix Emoji rendering in Vulkan
|
||||
- Rework color handling to take color states into account
|
||||
- Implement more powerful occlusion culling
|
||||
- Minimize our use of renderpasses
|
||||
|
||||
* Macos:
|
||||
- Fix window transparency
|
||||
|
||||
* Debugging:
|
||||
- The inspector shows details about color states
|
||||
|
||||
* Deprecations:
|
||||
- gdk_draw_context_begin/end_frame
|
||||
- gdk_surface_set_opaque_region
|
||||
|
||||
* Build:
|
||||
- Require gstreamer 1.24
|
||||
|
||||
* Translation updates
|
||||
Romanian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.4, 30-07-2024
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -454,6 +454,9 @@
|
||||
<file>icons/16x16/categories/applications-other.png</file>
|
||||
<file>icons/48x48/status/starred.png</file>
|
||||
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
|
||||
<file>portland-rose-thumbnail.png</file>
|
||||
<file>large-image-thumbnail.png</file>
|
||||
<file compressed="true">large-image.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo4/gtk">
|
||||
<file preprocess="xml-stripblanks">help-overlay.ui</file>
|
||||
|
||||
@@ -55,7 +55,7 @@ mode_switch_state_set (GtkSwitch *sw,
|
||||
{
|
||||
gtk_widget_set_visible (label, TRUE);
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
|
||||
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
|
||||
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label, NULL,
|
||||
-1);
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
|
||||
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
|
||||
|
||||
+150
-14
@@ -14,6 +14,103 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo3widget.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GCancellable *cancellable = NULL;
|
||||
|
||||
static void
|
||||
load_texture (GTask *task,
|
||||
gpointer source_object,
|
||||
gpointer task_data,
|
||||
GCancellable *cable)
|
||||
{
|
||||
GFile *file = task_data;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
texture = gdk_texture_new_from_file (file, &error);
|
||||
|
||||
if (texture)
|
||||
g_task_return_pointer (task, texture, g_object_unref);
|
||||
else
|
||||
g_task_return_error (task, error);
|
||||
}
|
||||
|
||||
static void
|
||||
set_wait_cursor (GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_set_cursor_from_name (GTK_WIDGET (gtk_widget_get_root (widget)), "wait");
|
||||
}
|
||||
|
||||
static void
|
||||
unset_wait_cursor (GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_set_cursor (GTK_WIDGET (gtk_widget_get_root (widget)), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_loaded (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
texture = g_task_propagate_pointer (G_TASK (result), &error);
|
||||
|
||||
if (!texture)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window)
|
||||
{
|
||||
g_object_unref (texture);
|
||||
return;
|
||||
}
|
||||
|
||||
unset_wait_cursor (GTK_WIDGET (data));
|
||||
|
||||
g_object_set (G_OBJECT (data), "texture", texture, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_async (GFile *file,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
set_wait_cursor (demo);
|
||||
|
||||
task = g_task_new (demo, cancellable, texture_loaded, demo);
|
||||
g_task_set_task_data (task, g_object_ref (file), g_object_unref);
|
||||
g_task_run_in_thread (task, load_texture);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
open_portland_rose (GtkWidget *button,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_uri ("resource:///transparent/portland-rose.jpg");
|
||||
open_file_async (file, demo);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
open_large_image (GtkWidget *button,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/Demo4/large-image.png");
|
||||
open_file_async (file, demo);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
file_opened (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -21,7 +118,6 @@ file_opened (GObject *source,
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
GdkTexture *texture;
|
||||
|
||||
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
|
||||
|
||||
@@ -32,17 +128,9 @@ file_opened (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_from_file (file, &error);
|
||||
g_object_unref (file);
|
||||
if (!texture)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
open_file_async (file, data);
|
||||
|
||||
g_object_set (G_OBJECT (data), "texture", texture, NULL);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -116,11 +204,26 @@ transform_from (GBinding *binding,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
free_cancellable (gpointer data)
|
||||
{
|
||||
g_cancellable_cancel (cancellable);
|
||||
g_clear_object (&cancellable);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cancel_load (GtkWidget *widget,
|
||||
GVariant *args,
|
||||
gpointer data)
|
||||
{
|
||||
unset_wait_cursor (widget);
|
||||
g_cancellable_cancel (G_CANCELLABLE (data));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_image_scaling (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *box;
|
||||
@@ -130,6 +233,7 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
GtkWidget *scale;
|
||||
GtkWidget *dropdown;
|
||||
GtkWidget *button;
|
||||
GtkEventController *controller;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Image Scaling");
|
||||
@@ -138,6 +242,20 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
cancellable = g_cancellable_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "cancellable",
|
||||
cancellable, free_cancellable);
|
||||
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
gtk_shortcut_new (
|
||||
gtk_keyval_trigger_new (GDK_KEY_Escape, 0),
|
||||
gtk_callback_action_new (cancel_load, cancellable, NULL)
|
||||
));
|
||||
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GTK_SHORTCUT_SCOPE_GLOBAL);
|
||||
gtk_widget_add_controller (window, controller);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
@@ -156,6 +274,22 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_file), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_button_set_child (GTK_BUTTON (button),
|
||||
gtk_image_new_from_resource ("/org/gtk/Demo4/portland-rose-thumbnail.png"));
|
||||
gtk_widget_add_css_class (button, "image-button");
|
||||
gtk_widget_set_tooltip_text (button, "Portland Rose");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_portland_rose), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_button_set_child (GTK_BUTTON (button),
|
||||
gtk_image_new_from_resource ("/org/gtk/Demo4/large-image-thumbnail.png"));
|
||||
gtk_widget_add_css_class (button, "image-button");
|
||||
gtk_widget_set_tooltip_text (button, "Large image");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_large_image), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("object-rotate-right-symbolic");
|
||||
gtk_widget_set_tooltip_text (button, "Rotate");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (rotate), widget);
|
||||
@@ -191,7 +325,9 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_set_visible (window, TRUE);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 622 KiB |
@@ -1068,6 +1068,8 @@ command_line (GApplication *app,
|
||||
|
||||
window = gtk_application_get_windows (GTK_APPLICATION (app))->data;
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "org.gtk.Demo4");
|
||||
|
||||
if (name == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -225,7 +225,8 @@ print_ready (GObject *source,
|
||||
|
||||
if (!g_output_stream_close (stream, NULL, &error))
|
||||
{
|
||||
g_print ("Error from close: %s\n", error->message);
|
||||
if (!g_error_matches (error, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_DISMISSED))
|
||||
g_print ("Error from close: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@@ -139,6 +139,8 @@ icon_browser_app_activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.IconBrowser4");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
|
||||
@@ -219,6 +219,8 @@ node_editor_application_activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.gtk4.NodeEditor");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
|
||||
@@ -1205,6 +1205,19 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
update_paste_action (GdkClipboard *clipboard,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (data);
|
||||
gboolean has_node;
|
||||
|
||||
has_node = gdk_content_formats_contain_mime_type (gdk_clipboard_get_formats (clipboard), "application/x-gtk-render-node");
|
||||
|
||||
gtk_widget_action_set_enabled (widget, "paste-node", has_node);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_realize (GtkWidget *widget)
|
||||
{
|
||||
@@ -1242,6 +1255,7 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
|
||||
G_CALLBACK (after_paint), self);
|
||||
|
||||
g_signal_connect (gtk_widget_get_clipboard (widget), "notify::formats", G_CALLBACK (update_paste_action), widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1251,6 +1265,8 @@ node_editor_window_unrealize (GtkWidget *widget)
|
||||
GdkFrameClock *frameclock;
|
||||
guint i;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (gtk_widget_get_clipboard (widget), update_paste_action, widget);
|
||||
|
||||
frameclock = gtk_widget_get_frame_clock (widget);
|
||||
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
|
||||
self->after_paint_handler = 0;
|
||||
@@ -1615,6 +1631,41 @@ edit_action_cb (GtkWidget *widget,
|
||||
node_editor_window_edit (self, &start);
|
||||
}
|
||||
|
||||
static void
|
||||
text_received (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (data);
|
||||
char *text;
|
||||
|
||||
text = gdk_clipboard_read_text_finish (clipboard, result, NULL);
|
||||
if (text)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, end;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
|
||||
gtk_text_buffer_begin_user_action (buffer);
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
gtk_text_buffer_delete (buffer, &start, &end);
|
||||
gtk_text_buffer_insert (buffer, &start, text, -1);
|
||||
gtk_text_buffer_end_user_action (buffer);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paste_node_cb (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
GVariant *parameter)
|
||||
{
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
|
||||
|
||||
gdk_clipboard_read_text_async (clipboard, NULL, text_received, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -1727,6 +1778,13 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
action = gtk_named_action_new ("smart-edit");
|
||||
shortcut = gtk_shortcut_new (trigger, action);
|
||||
gtk_widget_class_add_shortcut (widget_class, shortcut);
|
||||
|
||||
gtk_widget_class_install_action (widget_class, "paste-node", NULL, paste_node_cb);
|
||||
|
||||
trigger = gtk_keyval_trigger_new (GDK_KEY_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
|
||||
action = gtk_named_action_new ("paste-node");
|
||||
shortcut = gtk_shortcut_new (trigger, action);
|
||||
gtk_widget_class_add_shortcut (widget_class, shortcut);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
</menu>
|
||||
<menu id="extra_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Paste _Node</attribute>
|
||||
<attribute name="action">paste-node</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Assisted _Edit</attribute>
|
||||
<attribute name="action">smart-edit</attribute>
|
||||
|
||||
@@ -798,7 +798,7 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (main_window), "text-editor");
|
||||
gtk_window_set_icon_name (GTK_WINDOW (main_window), "org.gtk.PrintEditor4");
|
||||
gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
|
||||
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
|
||||
update_title (GTK_WINDOW (main_window));
|
||||
|
||||
@@ -2241,6 +2241,7 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (window, "org.gtk.WidgetFactory4");
|
||||
gtk_application_add_window (GTK_APPLICATION (app), window);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
|
||||
@@ -151,10 +151,11 @@ Checks whether the widget is set to be visible or not.
|
||||
- Methods are special functions whose first argument is always the instance
|
||||
of a certain class. The instance argument for newly written code should be
|
||||
called `self`.
|
||||
- If a method is a setter or a getter for an object property, you should
|
||||
add an `(attributes org.gtk.Method.set_property=property-name)` or a
|
||||
an `(attributes org.gtk.Method.get_property=property-name)` annotation
|
||||
to the method's identifier
|
||||
- If a method is a setter or a getter for an object property
|
||||
`GtkClassName:prop-name`, and if its name does not match the naming scheme
|
||||
`gtk_class_name_{g,s}et_prop_name`, you should add a `(set-property
|
||||
prop-name)` or a `(get-property prop-name)` annotation to the method's
|
||||
identifier
|
||||
- If a method changes one or more properties as side effect, link those
|
||||
properties in the method's description
|
||||
- If a method is a signal emitter, you should use the
|
||||
@@ -192,9 +193,10 @@ Checks whether the widget is set to be visible or not.
|
||||
purposes.
|
||||
- Always note if setting a property has side effects, like causing another
|
||||
property to change state.
|
||||
- If the property has public accessors you should annotate it with
|
||||
the `(attributes org.gtk.Property.set=setter_function)` and
|
||||
`(attributes org.gtk.Property.get=getter_function)` attributes
|
||||
- If a property `GtkClassName:prop-name` has a public getter or setter, and
|
||||
they do not match the naming scheme `gtk_class_name_{g,s}et_prop_name` you
|
||||
should annotate it with the `(setter setter_function)` and `(getter
|
||||
getter_function)`.
|
||||
- The syntax for property documentation is:
|
||||
|
||||
```c
|
||||
|
||||
@@ -38,7 +38,7 @@ if get_option('documentation')
|
||||
gdk_gir[0],
|
||||
],
|
||||
depends: gdk_gir[0],
|
||||
suite: ['docs'],
|
||||
suite: ['docs', 'failing'],
|
||||
)
|
||||
|
||||
if x11_enabled
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
Title: The Broadway windowing system
|
||||
Slug: broadway
|
||||
|
||||
## Using GTK with Broadway
|
||||
|
||||
The GDK Broadway backend provides support for displaying GTK applications in
|
||||
a web browser, using HTML5 and web sockets.
|
||||
|
||||
To run your application in this way, first run the broadway server,
|
||||
Broadway was written as an experiment and is not the most actively developed
|
||||
backend. It supports the features that were required of GDK backends in GTK 4.0,
|
||||
but may not be up-to-date with the latest developments.
|
||||
|
||||
## Using GTK with Broadway
|
||||
|
||||
To run your application under Broadway, first run the broadway server,
|
||||
`gtk-broadwayd`, that ships with GTK:
|
||||
|
||||
```
|
||||
|
||||
@@ -260,4 +260,4 @@ name = "StyleProvider"
|
||||
hidden = true
|
||||
|
||||
[check]
|
||||
skip_deprecated = true
|
||||
ignore_deprecated = true
|
||||
|
||||
@@ -74,7 +74,7 @@ if get_option('documentation')
|
||||
gtk_gir[0],
|
||||
],
|
||||
depends: gtk_gir[0],
|
||||
suite: ['docs'],
|
||||
suite: ['docs', 'failing'],
|
||||
)
|
||||
endif
|
||||
|
||||
|
||||
@@ -24,36 +24,36 @@ the motivation and goals of larger API changes.
|
||||
## Cell renderers are going away
|
||||
|
||||
Cell renderers were introduced in GTK 2 to support rendering of
|
||||
"big data" UIs, in particular treeviews. Over the years, more
|
||||
"data-like" widgets have started to use them, and cell renderers
|
||||
“big data” UIs, in particular treeviews. Over the years, more
|
||||
“data-like” widgets have started to use them, and cell renderers
|
||||
have grown into a shadowy, alternative rendering infrastructure
|
||||
that duplicates much of what widgets do, while duplicating the
|
||||
code and adding their own dose of bugs.
|
||||
|
||||
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
|
||||
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
|
||||
and GtkDropDown. For GTK 5, we will take the next step and remove
|
||||
In GTK 4, replacement widgets for `GtkTreeView`, `GtkIconView` and
|
||||
`GtkComboBox` have appeared: [class@Gtk.ListView], [class@Gtk.ColumnView], [class@Gtk.GridView]
|
||||
and [class@Gtk.DropDown]. For GTK 5, we will take the next step and remove
|
||||
all cell renderer-based widgets.
|
||||
|
||||
## Themed rendering APIs are going away
|
||||
|
||||
The old GTK 2 era rendering APIs for theme components like
|
||||
gtk_render_frame() or gtk_render_check() have not been used by
|
||||
`gtk_render_frame()` or `gtk_render_check()` have not been used by
|
||||
GTK itself even in later GTK 3, but they have been kept around
|
||||
for the benefit of "external drawing" users - applications that
|
||||
for the benefit of “external drawing” users — applications that
|
||||
want their controls to look like GTK without using widgets.
|
||||
|
||||
Supporting this is increasingly getting in the way of making
|
||||
the GTK CSS machinery fast and correct. One notable problem is
|
||||
that temporary style changes (using gtk_style_context_save())
|
||||
that temporary style changes (using `gtk_style_context_save()`)
|
||||
is breaking animations. Therefore, these APIs will be going away
|
||||
in GTK 5, together with their more modern GtkSnapshot variants
|
||||
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
|
||||
in GTK 5, together with their more modern [class@Gtk.Snapshot] variants
|
||||
like `gtk_snapshot_render_background()` or `gtk_snapshot_render_focus()`.
|
||||
|
||||
The best way to render parts of your widget using CSS styling
|
||||
is to use subwidgets. For example, to show a piece of text with
|
||||
fonts, effects and shadows according to the current CSS style,
|
||||
use a GtkLabel.
|
||||
use a [class@Gtk.Label].
|
||||
|
||||
If you have a need for custom drawing that fits into the current
|
||||
(dark or light) theme, e.g. for rendering a graph, you can still
|
||||
@@ -62,28 +62,28 @@ get the current style foreground color, using
|
||||
|
||||
## Local stylesheets are going away
|
||||
|
||||
The cascading part of GTK's CSS implementation is complicated by
|
||||
The cascading part of GTK’s CSS implementation is complicated by
|
||||
the existence of local stylesheets (i.e. those added with
|
||||
gtk_style_context_add_provider()). And local stylesheets are
|
||||
`gtk_style_context_add_provider()`). And local stylesheets are
|
||||
unintuitive in that they do not apply to the whole subtree of
|
||||
widgets, but just to the one widget where the stylesheet was
|
||||
added.
|
||||
|
||||
GTK 5 will no longer provide this functionality. The recommendations
|
||||
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
|
||||
GTK 5 will no longer provide this functionality. The recommendation
|
||||
is to use a global stylesheet (i.e. [func@Gtk.StyleContext.add_provider_for_display])
|
||||
and rely on style classes to make your CSS apply only where desired.
|
||||
|
||||
## Non-standard CSS extensions are going away
|
||||
|
||||
GTK's CSS machinery has a some non-standard extensions around colors:
|
||||
named colors with \@define-color and color functions: lighter(), darker(),
|
||||
shade(), alpha(), mix().
|
||||
GTK’s CSS machinery has a some non-standard extensions around colors:
|
||||
named colors with `@define-color` and color functions: `lighter()`, `darker()`,
|
||||
`shade()`, `alpha()`, `mix()`.
|
||||
|
||||
GTK now implements equivalent functionality from the CSS specs.
|
||||
|
||||
### \@define-color is going away
|
||||
### `@define-color` is going away
|
||||
|
||||
\@define-color should be replaced by custom properties in the :root scope.
|
||||
`@define-color` should be replaced by custom properties in the `:root` scope.
|
||||
|
||||
Instead of
|
||||
|
||||
@@ -117,9 +117,9 @@ spec.
|
||||
|
||||
### Color expressions are going away
|
||||
|
||||
The color functions can all be replaced by combinations of calc() and color-mix().
|
||||
The color functions can all be replaced by combinations of `calc()` and `color-mix()`.
|
||||
|
||||
ligher(c) and darker(c) are just shade(c, 1.3) or shade(c, 0.7), respectively, and
|
||||
`lighter(c)` and `darker(c)` are just `shade(c, 1.3)` or `shade(c, 0.7)`, respectively, and
|
||||
thus can be handled the same way as shade in the examples below.
|
||||
|
||||
Replace
|
||||
@@ -164,7 +164,7 @@ d {
|
||||
|
||||
Variations of these replacements are possible.
|
||||
|
||||
Note that GTK has historically computed mix() and shade() values in the SRGB and HSL
|
||||
Note that GTK has historically computed `mix()` and `shade()` values in the SRGB and HSL
|
||||
colorspaces, but using OKLAB instead might yield slightly better results.
|
||||
|
||||
For more information about color-mix(), see the
|
||||
@@ -172,32 +172,32 @@ For more information about color-mix(), see the
|
||||
|
||||
## Chooser interfaces are going away
|
||||
|
||||
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
|
||||
The `GtkColorChooser`, `GtkFontChooser`, `GtkFileChooser` and `GtkAppChooser`
|
||||
interfaces and their implementations as dialogs, buttons and widgets
|
||||
are phased out. The are being replaced by a new family of async APIs
|
||||
that will be more convenient to use from language bindings, in particular
|
||||
for languages that have concepts like promises. The new APIs are
|
||||
[class@Gtk.ColorDialog], [class@Gtk.FontDialog] and [class@Gtk.FileDialog],
|
||||
There are also equivalents for some of the 'button' widgets:
|
||||
There are also equivalents for some of the “button” widgets:
|
||||
[class@Gtk.ColorDialogButton], [class@Gtk.FontDialogButton].
|
||||
|
||||
## GtkMessageDialog is going away
|
||||
|
||||
Like the Chooser interfaces, GtkMessageDialog has been replaced by
|
||||
Like the Chooser interfaces, `GtkMessageDialog` has been replaced by
|
||||
a new async API that will be more convenient, in particular for
|
||||
language binding. The new API is [class@Gtk.AlertDialog].
|
||||
|
||||
## GtkDialog is going away
|
||||
|
||||
After gtk_dialog_run() was removed, the usefulness of GtkDialog
|
||||
is much reduced, and it has awkward, archaice APIs. Therefore,
|
||||
After `gtk_dialog_run()` was removed, the usefulness of `GtkDialog`
|
||||
is much reduced, and it has awkward, archaic APIs. Therefore,
|
||||
it is dropped. The recommended replacement is to just create
|
||||
your own window and add buttons as required, either in the header
|
||||
or elsewhere.
|
||||
|
||||
## GtkInfoBar is going away
|
||||
|
||||
GtkInfoBar had a dialog API, and with dialogs going away, it was time to
|
||||
`GtkInfoBar` had a dialog API, and with dialogs going away, it was time to
|
||||
retire it. If you need such a widget, it is relatively trivial to create one
|
||||
using a [class@Gtk.Revealer] with labels and buttons.
|
||||
|
||||
@@ -205,11 +205,11 @@ Other libraries, such as libadwaita, may provide replacements as well.
|
||||
|
||||
## gtk_show_uri is being replaced
|
||||
|
||||
Instead of gtk_show_uri(), you should use GtkUriLauncher or GtkFileLauncher.
|
||||
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]or [class@Gtk.FileLauncher].
|
||||
|
||||
## GtkStatusbar is going away
|
||||
|
||||
This is an oldfashioned widget that does not do all that much anymore, since
|
||||
This is an old fashioned widget that does not do all that much any more, since
|
||||
it no longer has a resize handle for the window.
|
||||
|
||||
## GtkLockButton and GtkVolumeButton are going away
|
||||
@@ -217,22 +217,22 @@ it no longer has a resize handle for the window.
|
||||
These are very specialized widgets that should better live with the application
|
||||
where they are used.
|
||||
|
||||
## Widget size api changes
|
||||
## Widget size API changes
|
||||
|
||||
The functions gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height()
|
||||
The functions `gtk_widget_get_allocated_width()` and `gtk_widget_get_allocated_height()`
|
||||
are going away. In most cases, [method@Gtk.Widget.get_width] and [method@Gtk.Widget.get_height]
|
||||
are suitable replacements. Note that the semantics are slightly different though:
|
||||
the old functions return the size of the CSS border area, while the new functions return
|
||||
the size of the widgets content area. In places where this difference matters, you can
|
||||
use `gtk_widget_compute_bounds (widget, widget, &bounds)` instead.
|
||||
|
||||
The function gtk_widget_get_allocation() is also going away. It does not have a direct
|
||||
The function `gtk_widget_get_allocation()` is also going away. It does not have a direct
|
||||
replacement, but the previously mentioned alternatives can be used for it too.
|
||||
|
||||
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
|
||||
The function `gtk_widget_get_allocated_baseline()` has been renamed to [method@Gtk.Widget.get_baseline].
|
||||
|
||||
## Stop using GdkPixbuf
|
||||
|
||||
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
|
||||
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
|
||||
APIs using GdkTexture or GdkPaintable objects.
|
||||
GTK is moving away from `GdkPixbuf` as the primary API for transporting image data, in favor
|
||||
of [class@Gdk.Texture]. APIs that are accepting or returning `GdkPixbuf`s are being replaced by equivalent
|
||||
APIs using `GdkTexture` or [iface@Gdk.Paintable] objects.
|
||||
|
||||
@@ -6,7 +6,7 @@ The format is a text format that follows the [CSS syntax rules](https://drafts.c
|
||||
|
||||
The grammar of a node text representation using [the CSS value definition syntax](https://drafts.csswg.org/css-values-3/#value-defs) looks like this:
|
||||
|
||||
document: <@-rule>*<node>*
|
||||
document: <@-rule>*<node>
|
||||
@-rule: @cicp "name" { <property>* }
|
||||
node: container [ "name" ] { <document> } | <node-type> [ "name" ] { <property>* } | "name"
|
||||
property: <property-name>: <node> | <value> ;
|
||||
@@ -49,12 +49,16 @@ The following properties can be set for custom color states:
|
||||
| primaries | `<integer>` | 2 | always |
|
||||
| transfer | `<integer>` | 2 | always |
|
||||
| matrix | `<integer>` | 2 | always |
|
||||
| range | `narrow | full` | full | non-default |
|
||||
| range | `<range>` | full | non-default |
|
||||
|
||||
Note that the primaries, transfer and matrix properties always need
|
||||
to be specified, since GTK does not allow creating color state objects
|
||||
with these being set to 2 (== unspecified).
|
||||
|
||||
Range can have the following values:
|
||||
|
||||
range: narrow | full
|
||||
|
||||
# Colors
|
||||
|
||||
Colors can be specified with a variation of the modern CSS color syntax:
|
||||
@@ -66,6 +70,16 @@ The traditional syntax for sRGB colors still works as well:
|
||||
rgba(<number>, <number>, <number>, <number)
|
||||
rgb(<number, <number>, <number>)
|
||||
|
||||
# Rectangles
|
||||
|
||||
Rectangles can be specified just as four integers for x, y, width and height:
|
||||
|
||||
rect: <number> <number> <number> <number>
|
||||
|
||||
Rounded rectangles use a CSS-like syntax:
|
||||
|
||||
rounded-rect: <rect> [ "/" <number>{1,4} [ "/" <number>{1,4} ] ]
|
||||
|
||||
# Nodes
|
||||
|
||||
### container
|
||||
@@ -82,6 +96,13 @@ The **container** node is a special node that allows specifying a list of child
|
||||
|
||||
Creates a node like `gsk_blend_node_new()` with the given properties.
|
||||
|
||||
Possible values for the mode property are:
|
||||
|
||||
blend-mode: normal | multiply | screen | overlay | darken |
|
||||
lighten | color-dodge | color-burn | hard-light |
|
||||
soft-light | difference | exclusion | color |
|
||||
hue | saturation | luminosity
|
||||
|
||||
### blur
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -201,6 +222,10 @@ Creates a node like `gsk_fill_node_new()` with the given properties.
|
||||
The default child node is the default color node, but created with the
|
||||
bounds of the path.
|
||||
|
||||
Possible values for the fill-rule property are:
|
||||
|
||||
fill-rule: winding | even-odd
|
||||
|
||||
### glshader
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -252,6 +277,10 @@ Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
|
||||
|
||||
Creates a node like `gsk_mask_node_new()` with the given properties.
|
||||
|
||||
Possible values for the mode property are:
|
||||
|
||||
mask-mode: alpha | inverted-alpha | luminance | inverted-luminance
|
||||
|
||||
### opacity
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -290,11 +319,11 @@ Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
|
||||
|
||||
### repeat
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ----------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | *bounds of child node* | non-default |
|
||||
| child | `<node>` | color { } | always |
|
||||
| child-bounds| `<rect>` | *bounds of child node* | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| ------------ | ---------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | *bounds of child node* | non-default |
|
||||
| child | `<node>` | color { } | always |
|
||||
| child-bounds | `<rect>` | *bounds of child node* | non-default |
|
||||
|
||||
Creates a node like `gsk_repeat_node_new()` with the given properties.
|
||||
|
||||
@@ -361,6 +390,14 @@ Creates a node like `gsk_stroke_node_new()` with the given properties.
|
||||
The default child node is the default color node, but created with the
|
||||
stroke bounds of the path.
|
||||
|
||||
Possible values for the line-cap property are:
|
||||
|
||||
line-cap: butt | round | square
|
||||
|
||||
Possible values for the line-join property are:
|
||||
|
||||
line-join: miter | round | bevel
|
||||
|
||||
### text
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -369,9 +406,9 @@ stroke bounds of the path.
|
||||
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| hint-style | `<hint style>` | slight | non-default |
|
||||
| hint-style | `<hint-style>` | slight | non-default |
|
||||
| antialias | `<antialias>` | gray | non-default |
|
||||
| hint-metrics | `<hint metrics>` | off | non-default |
|
||||
| hint-metrics | `<hint-metrics>` | off | non-default |
|
||||
|
||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||
|
||||
@@ -386,9 +423,17 @@ be specified as well, like this: 40 10 0 0 color.
|
||||
If the given font does not exist or the given glyphs are invalid for the given
|
||||
font, an error node will be returned.
|
||||
|
||||
Possible values for hint-style are none, slight or full.
|
||||
Possible value for antialias are none or gray.
|
||||
Possible value for hint-metrics are on or off.
|
||||
Possible values for the hint-style property are:
|
||||
|
||||
hint-style: none | slight | full
|
||||
|
||||
Possible value for the antialias property are:
|
||||
|
||||
antialias: none | gray
|
||||
|
||||
Possible value for hint-metrics are:
|
||||
|
||||
hint-metrics: on | off
|
||||
|
||||
### texture
|
||||
|
||||
@@ -414,14 +459,15 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| texture | `<url>` | *see below* | always |
|
||||
| filter | `filter` | *see below* | non-default |
|
||||
| filter | `filter` | linear | non-default |
|
||||
|
||||
Creates a node like `gsk_texture_scale_node_new()` with the given properties.
|
||||
|
||||
The default texture is a 10x10 checkerboard, just like for texture.
|
||||
|
||||
The possible filter values are `linear`, `nearest` and `trilinear`, with
|
||||
`linear` being the default.
|
||||
Possible values for the filter property are:
|
||||
|
||||
filter: linear | nearest | trilinear
|
||||
|
||||
### transform
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ be used for end-user configuration and customization.
|
||||
### `GTK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GTK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
print out different types of debugging information.
|
||||
|
||||
`actions`
|
||||
: Actions and menu models
|
||||
@@ -65,7 +64,7 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
||||
: Layout managers
|
||||
|
||||
`accessibility`
|
||||
: Accessibility state changs
|
||||
: Accessibility state changes
|
||||
|
||||
A number of keys are influencing behavior instead of just logging:
|
||||
|
||||
@@ -169,8 +168,7 @@ The `loaders.cache` file is generated by the
|
||||
### `GDK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GDK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
print out different types of debugging information.
|
||||
|
||||
`misc`
|
||||
: Miscellaneous information
|
||||
@@ -223,36 +221,15 @@ A number of options affect behavior instead of logging:
|
||||
: Force graphics offload for all textures, even when slower. This allows
|
||||
to debug offloading in the absence of dmabufs.
|
||||
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-no-fractional`
|
||||
: Disable fractional scaling for OpenGL.
|
||||
|
||||
`gl-debug`
|
||||
: Insert debugging information in OpenGL
|
||||
|
||||
`gl-disable-gl`
|
||||
: Don't allow the use of OpenGL GL API. This forces GLES to be used
|
||||
|
||||
`gl-disable-gles`
|
||||
: Don't allow the use of OpenGL GLES API. This forces GL to be used
|
||||
|
||||
`gl-prefer-gl`
|
||||
: Prefer OpenGL over OpenGL ES. This was the default behavior before GTK 4.14.
|
||||
|
||||
`gl-egl`
|
||||
: Use an EGL context on X11 or Windows
|
||||
|
||||
`gl-glx`
|
||||
: Use GLX on X11
|
||||
|
||||
`gl-wgl`
|
||||
: Use WGL on Windows
|
||||
|
||||
`vulkan-disable`
|
||||
: Disable Vulkan support
|
||||
|
||||
`vulkan-validate`
|
||||
: Load the Vulkan validation layer, if available
|
||||
|
||||
@@ -262,27 +239,26 @@ A number of options affect behavior instead of logging:
|
||||
`high-depth`
|
||||
: Use high bit depth rendering if possible
|
||||
|
||||
`linear`
|
||||
: Enable linear rendering
|
||||
|
||||
`hdr`
|
||||
: Force HDR rendering
|
||||
|
||||
`no-vsync`
|
||||
: Repaint instantly (uses 100% CPU with animations)
|
||||
|
||||
`dmabuf-disable`
|
||||
: Disable dmabuf support
|
||||
|
||||
The special value `all` can be used to turn on all debug options. The special
|
||||
value `help` can be used to obtain a list of all supported debug options.
|
||||
|
||||
### `GSK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GSK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
print out different types of debugging information.
|
||||
|
||||
`renderer`
|
||||
: General renderer information
|
||||
|
||||
`opengl`
|
||||
: OpenGL renderer information
|
||||
|
||||
`vulkan`
|
||||
: Check Vulkan errors
|
||||
|
||||
@@ -309,12 +285,12 @@ A number of options affect behavior instead of logging:
|
||||
`staging`
|
||||
: Use a staging image for texture upload (Vulkan only)
|
||||
|
||||
`offload-disable`
|
||||
: Disable graphics offload to subsurfaces
|
||||
|
||||
`cairo`
|
||||
: Overlay error pattern over cairo drawing (finds fallbacks)
|
||||
|
||||
`occlusion`
|
||||
: Overlay highlight over areas optimized via occlusion culling
|
||||
|
||||
The special value `all` can be used to turn on all debug options. The special
|
||||
value `help` can be used to obtain a list of all supported debug options.
|
||||
|
||||
@@ -347,6 +323,41 @@ a `*`, which means: try all remaining backends. The special value
|
||||
backends. For more information about selecting backends,
|
||||
see the [func@Gdk.DisplayManager.get] function.
|
||||
|
||||
### `GDK_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable certain features.
|
||||
|
||||
`gl`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-api`
|
||||
: Don't allow the use of OpenGL GL API. This forces GLES to be used
|
||||
|
||||
`gles-api`
|
||||
: Don't allow the use of OpenGL GLES API. This forces GL to be used
|
||||
|
||||
`egl`
|
||||
: Don't allow the use of an EGL context
|
||||
|
||||
`glx`
|
||||
: Don't allow the use of GLX
|
||||
|
||||
`wgl`
|
||||
: Don't allow the use of WGL
|
||||
|
||||
`vulkan`
|
||||
: Disable Vulkan support
|
||||
|
||||
`dmabuf`
|
||||
: Disable dmabuf support
|
||||
|
||||
`offload`
|
||||
: Disable graphics offload to subsurfaces
|
||||
|
||||
`color-mgmt`
|
||||
: Disable color management
|
||||
|
||||
### `GDK_GL_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
@@ -389,15 +400,6 @@ does not support them.
|
||||
`ycbr`
|
||||
: Do not support Ycbcr textures
|
||||
|
||||
`descriptor-indexing`
|
||||
: Force slow descriptor set layout codepath
|
||||
|
||||
`dynamic-indexing`
|
||||
: Hardcode small number of buffer and texture arrays
|
||||
|
||||
`nonuniform-indexing`
|
||||
: Split draw calls to ensure uniform texture accesses
|
||||
|
||||
`semaphore-export`
|
||||
: Disable sync of exported dmabufs
|
||||
|
||||
@@ -407,6 +409,9 @@ does not support them.
|
||||
`incremental-present`
|
||||
: Do not send damage regions
|
||||
|
||||
`swapchain-maintenance`
|
||||
: Do not use advanced swapchain features
|
||||
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
@@ -461,12 +466,12 @@ using and the GDK backend supports them:
|
||||
This variable can be set to a list of values, which cause GSK to
|
||||
disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
|
||||
`uber`
|
||||
: Don't use the uber shader
|
||||
|
||||
`clear`
|
||||
: Use shaders instead of vkCmdClearAttachment()/glClear()
|
||||
|
||||
`merge`
|
||||
: USe one vkCmdDraw()/glDrawArrays() per operation
|
||||
|
||||
`blit`
|
||||
: Use shaders instead of vkCmdBlit()/glBlitFramebuffer()
|
||||
|
||||
@@ -476,6 +481,13 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
`mipmap`
|
||||
: Avoid creating mipmaps
|
||||
|
||||
`to-image`
|
||||
: Don't fast-path creation of images for nodes
|
||||
|
||||
`occlusion`
|
||||
: Disable occlusion culling via opacity tracking
|
||||
|
||||
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
@@ -563,6 +575,12 @@ To enable the GTK inspector, you can use the <kbd>Control</kbd>+<kbd>Shift</kbd>
|
||||
<kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> keyboard shortcuts, or
|
||||
set the `GTK_DEBUG=interactive` environment variable.
|
||||
|
||||
After opening the inspector, it listens for a few keyboard shortcuts that
|
||||
let you use its frame and event recording functionality without moving the
|
||||
focus away from the application window: <kbd>Super</kbd>+<kbd>R</kbd> turns
|
||||
the recording on and off, and <kbd>Super</kbd>+<kbd>C</kbd> records a single
|
||||
frame.
|
||||
|
||||
There are a few more environment variables that can be set to influence
|
||||
how the inspector renders its UI. `GTK_INSPECTOR_DISPLAY` and
|
||||
`GTK_INSPECTOR_RENDERER` determine the GDK display and the GSK
|
||||
@@ -573,6 +591,7 @@ the GTK inspector. The keyboard shortcuts can be disabled with the
|
||||
`enable-inspector-keybinding` key in the `org.gtk.Settings.Debug`
|
||||
GSettings schema.
|
||||
|
||||
|
||||
## Profiling
|
||||
|
||||
GTK supports profiling with sysprof. It exports timing information
|
||||
|
||||
@@ -171,7 +171,7 @@ Each relation name is part of the `GtkAccessibleRelation` enumeration.
|
||||
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a list of `GtkAccessible` |
|
||||
@@ -300,7 +300,7 @@ The attributes can also enhance the UI:
|
||||
|
||||
```c
|
||||
gtk_button_set_label (GTK_BUTTON (button), "Download");
|
||||
gtk_box_append (GTK_BOX (button), button);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (label), "Final report.pdf");
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
@@ -9,6 +9,7 @@ documentation in the form of man pages.
|
||||
- [gtk4-demo-application](gtk4-demo-application.html)
|
||||
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
|
||||
- [gtk4-icon-browser](gtk4-icon-browser.html)
|
||||
- [gtk4-image-tool](gtk4-image-tool.html)
|
||||
- [gtk4-launch](gtk4-launch.html)
|
||||
- [gtk4-node-editor](gtk4-node-editor.html)
|
||||
- [gtk4-path-tool](gtk4-path-tool.html)
|
||||
|
||||
@@ -49,6 +49,135 @@
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwaySurface, gdk_broadway_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_toplevel_resize (GdkSurface *surface,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_geometry_hints (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask);
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
static void
|
||||
compute_toplevel_size (GdkSurface *surface,
|
||||
gboolean resizible,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkToplevelSize size;
|
||||
int bounds_width, bounds_height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
impl->resizible = (impl->resizible && resizible);
|
||||
|
||||
if (impl->resizible)
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = size.width;
|
||||
geometry.max_height = geometry.min_height = size.height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
gdk_broadway_surface_set_geometry_hints (surface, &geometry, mask);
|
||||
|
||||
if (!(surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_TILED |
|
||||
GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED)))
|
||||
{
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
size.width, size.height,
|
||||
&size.width, &size.height);
|
||||
|
||||
if (impl->last_computed_width != size.width ||
|
||||
impl->last_computed_height != size.height)
|
||||
{
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
impl->last_computed_width = size.width;
|
||||
impl->last_computed_height = size.height;
|
||||
|
||||
gdk_broadway_surface_toplevel_resize (surface, *width, *height);
|
||||
}
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
{
|
||||
impl->shadow_left = size.shadow.left;
|
||||
impl->shadow_right = size.shadow.right;
|
||||
impl->shadow_top = size.shadow.top;
|
||||
impl->shadow_bottom = size.shadow.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
compute_size_idle (gpointer user_data)
|
||||
{
|
||||
GdkSurface *surface = user_data;
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
int width, height;
|
||||
|
||||
impl->compute_size_source_id = 0;
|
||||
compute_toplevel_size (surface, TRUE, &width, &height);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_frame_clock_after_update (GdkFrameClock *clock,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (impl->compute_size_source_id)
|
||||
{
|
||||
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
|
||||
compute_size_idle (surface);
|
||||
}
|
||||
}
|
||||
|
||||
/* We need to flush in an idle rather than AFTER_PAINT, as the clock
|
||||
is frozen during e.g. surface resizes so the paint will not happen
|
||||
and the surface resize request is never flushed. */
|
||||
@@ -112,6 +241,8 @@ connect_frame_clock (GdkSurface *surface)
|
||||
|
||||
g_signal_connect (frame_clock, "before-paint",
|
||||
G_CALLBACK (on_frame_clock_before_paint), surface);
|
||||
g_signal_connect_after (frame_clock, "update",
|
||||
G_CALLBACK (on_frame_clock_after_update), surface);
|
||||
g_signal_connect (frame_clock, "after-paint",
|
||||
G_CALLBACK (on_frame_clock_after_paint), surface);
|
||||
}
|
||||
@@ -123,6 +254,8 @@ disconnect_frame_clock (GdkSurface *surface)
|
||||
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
on_frame_clock_before_paint, surface);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
on_frame_clock_after_update, surface);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
on_frame_clock_after_paint, surface);
|
||||
}
|
||||
@@ -137,6 +270,7 @@ gdk_broadway_surface_constructed (GObject *object)
|
||||
if (!surface->parent)
|
||||
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, self);
|
||||
|
||||
self->resizible = TRUE;
|
||||
self->id = _gdk_broadway_server_new_surface (broadway_display->server,
|
||||
self->root_x,
|
||||
self->root_y,
|
||||
@@ -316,6 +450,7 @@ gdk_broadway_surface_hide (GdkSurface *surface)
|
||||
|
||||
_gdk_broadway_surface_grab_check_unmap (surface,
|
||||
_gdk_broadway_server_get_next_serial (broadway_display->server));
|
||||
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
|
||||
|
||||
if (_gdk_broadway_server_surface_hide (broadway_display->server, impl->id))
|
||||
queue_flush (surface);
|
||||
@@ -1009,6 +1144,8 @@ _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
|
||||
BroadwayInputMsg *tmp_event;
|
||||
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
||||
|
||||
gdk_surface_request_layout (surface);
|
||||
|
||||
if (!mv_resize || surface != mv_resize->moveresize_surface)
|
||||
return FALSE;
|
||||
|
||||
@@ -1168,6 +1305,43 @@ gdk_broadway_surface_beep (GdkSurface *surface)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_request_layout (GdkSurface *surface)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (!impl->compute_size_source_id &&
|
||||
GDK_IS_TOPLEVEL (surface))
|
||||
{
|
||||
impl->compute_size_source_id = g_idle_add_full (G_PRIORITY_HIGH - 10,
|
||||
compute_size_idle,
|
||||
surface,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_surface_compute_size (GdkSurface *surface)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
{
|
||||
compute_toplevel_size (surface, TRUE, &width, &height);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gdk_surface_get_width(surface);
|
||||
height = gdk_surface_get_height(surface);
|
||||
|
||||
gdk_broadway_surface_move_resize_internal (surface, FALSE,
|
||||
0, 0,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
{
|
||||
@@ -1187,6 +1361,8 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
|
||||
impl_class->get_scale = gdk_broadway_surface_get_scale;
|
||||
impl_class->request_layout = gdk_broadway_surface_request_layout;
|
||||
impl_class->compute_size = gdk_broadway_surface_compute_size;
|
||||
}
|
||||
|
||||
#define LAST_PROP 1
|
||||
@@ -1504,55 +1680,12 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkToplevelSize size;
|
||||
int bounds_width, bounds_height;
|
||||
int width, height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
gboolean maximize;
|
||||
|
||||
gdk_broadway_surface_unminimize (surface);
|
||||
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (toplevel, &size);
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
|
||||
if (gdk_toplevel_layout_get_resizable (layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = width;
|
||||
geometry.max_height = geometry.min_height = height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
gdk_broadway_surface_set_geometry_hints (surface, &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
gdk_broadway_surface_toplevel_resize (surface, width, height);
|
||||
compute_toplevel_size (surface, gdk_toplevel_layout_get_resizable (layout), &width, &height);
|
||||
|
||||
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
|
||||
{
|
||||
@@ -1562,14 +1695,7 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
|
||||
gdk_broadway_surface_unmaximize (surface);
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
{
|
||||
impl->shadow_left = size.shadow.left;
|
||||
impl->shadow_right = size.shadow.right;
|
||||
impl->shadow_top = size.shadow.top;
|
||||
impl->shadow_bottom = size.shadow.bottom;
|
||||
}
|
||||
|
||||
gdk_surface_request_layout (surface);
|
||||
show_surface (surface);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,13 @@ struct _GdkBroadwaySurface
|
||||
int shadow_right;
|
||||
int shadow_top;
|
||||
int shadow_bottom;
|
||||
|
||||
int last_computed_width;
|
||||
int last_computed_height;
|
||||
|
||||
guint compute_size_source_id;
|
||||
|
||||
gboolean resizible;
|
||||
};
|
||||
|
||||
struct _GdkBroadwaySurfaceClass
|
||||
|
||||
+59
-59
@@ -53,18 +53,18 @@ typedef struct {
|
||||
const char **files;
|
||||
int len;
|
||||
int start;
|
||||
} AddFileData;
|
||||
} FileTransferAddFileData;
|
||||
|
||||
static void add_files (GDBusProxy *proxy,
|
||||
AddFileData *afd);
|
||||
static void file_transfer_add_files (GDBusProxy *proxy,
|
||||
FileTransferAddFileData *afd);
|
||||
|
||||
static void
|
||||
add_files_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
file_transfer_add_files_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (object);
|
||||
AddFileData *afd = data;
|
||||
FileTransferAddFileData *afd = data;
|
||||
GError *error = NULL;
|
||||
GVariant *ret;
|
||||
|
||||
@@ -87,15 +87,15 @@ add_files_done (GObject *object,
|
||||
return;
|
||||
}
|
||||
|
||||
add_files (proxy, afd);
|
||||
file_transfer_add_files (proxy, afd);
|
||||
}
|
||||
|
||||
/* We call AddFiles in chunks of 16 to avoid running into
|
||||
* the per-message fd limit of the bus.
|
||||
*/
|
||||
static void
|
||||
add_files (GDBusProxy *proxy,
|
||||
AddFileData *afd)
|
||||
file_transfer_add_files (GDBusProxy *proxy,
|
||||
FileTransferAddFileData *afd)
|
||||
{
|
||||
GUnixFDList *fd_list;
|
||||
GVariantBuilder fds, options;
|
||||
@@ -154,18 +154,18 @@ add_files (GDBusProxy *proxy,
|
||||
0, -1,
|
||||
fd_list,
|
||||
NULL,
|
||||
add_files_done, afd);
|
||||
file_transfer_add_files_done, afd);
|
||||
|
||||
g_object_unref (fd_list);
|
||||
}
|
||||
|
||||
static void
|
||||
start_session_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
file_transfer_start_session_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (object);
|
||||
AddFileData *afd = data;
|
||||
FileTransferAddFileData *afd = data;
|
||||
GError *error = NULL;
|
||||
GVariant *ret;
|
||||
const char *key;
|
||||
@@ -185,7 +185,7 @@ start_session_done (GObject *object,
|
||||
|
||||
g_variant_unref (ret);
|
||||
|
||||
add_files (proxy, afd);
|
||||
file_transfer_add_files (proxy, afd);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -195,7 +195,7 @@ file_transfer_portal_register_files (const char **files,
|
||||
gpointer data)
|
||||
{
|
||||
GTask *task;
|
||||
AddFileData *afd;
|
||||
FileTransferAddFileData *afd;
|
||||
GVariantBuilder options;
|
||||
|
||||
task = g_task_new (NULL, NULL, callback, data);
|
||||
@@ -208,7 +208,7 @@ file_transfer_portal_register_files (const char **files,
|
||||
return;
|
||||
}
|
||||
|
||||
afd = g_new (AddFileData, 1);
|
||||
afd = g_new (FileTransferAddFileData, 1);
|
||||
afd->task = task;
|
||||
afd->files = files;
|
||||
afd->len = g_strv_length ((char **)files);
|
||||
@@ -222,7 +222,7 @@ file_transfer_portal_register_files (const char **files,
|
||||
|
||||
g_dbus_proxy_call (file_transfer_proxy, "StartTransfer",
|
||||
g_variant_new ("(a{sv})", &options),
|
||||
0, -1, NULL, start_session_done, afd);
|
||||
0, -1, NULL, file_transfer_start_session_done, afd);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -240,9 +240,9 @@ file_transfer_portal_register_files_finish (GAsyncResult *result,
|
||||
}
|
||||
|
||||
static void
|
||||
retrieve_files_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
file_transfer_retrieve_files_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (object);
|
||||
GTask *task = data;
|
||||
@@ -260,7 +260,7 @@ retrieve_files_done (GObject *object,
|
||||
|
||||
g_variant_get (ret, "(^a&s)", &files);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (task), "files", g_strdupv (files), (GDestroyNotify)g_strfreev);
|
||||
g_object_set_data_full (G_OBJECT (task), "files", g_strdupv (files), (GDestroyNotify) g_strfreev);
|
||||
|
||||
g_variant_unref (ret);
|
||||
|
||||
@@ -290,7 +290,7 @@ file_transfer_portal_retrieve_files (const char *key,
|
||||
"RetrieveFiles",
|
||||
g_variant_new ("(sa{sv})", key, &options),
|
||||
0, -1, NULL,
|
||||
retrieve_files_done, task);
|
||||
file_transfer_retrieve_files_done, task);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -311,9 +311,9 @@ file_transfer_portal_retrieve_files_finish (GAsyncResult *result,
|
||||
/* serializer */
|
||||
|
||||
static void
|
||||
file_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
gdk_content_serializer_file_portal_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -325,9 +325,9 @@ file_serializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
portal_ready (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
file_transfer_portal_ready (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *key;
|
||||
@@ -343,13 +343,13 @@ portal_ready (GObject *object,
|
||||
strlen (key) + 1,
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
file_serializer_finish,
|
||||
gdk_content_serializer_file_portal_finish,
|
||||
serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, key, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
portal_file_serializer (GdkContentSerializer *serializer)
|
||||
file_transfer_portal_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GPtrArray *files;
|
||||
const GValue *value;
|
||||
@@ -403,16 +403,16 @@ portal_file_serializer (GdkContentSerializer *serializer)
|
||||
}
|
||||
|
||||
/* this call doesn't copy the strings, so keep the array around until the registration is done */
|
||||
file_transfer_portal_register_files ((const char **)files->pdata, TRUE, portal_ready, serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, files, (GDestroyNotify)g_ptr_array_unref);
|
||||
file_transfer_portal_register_files ((const char **)files->pdata, TRUE, file_transfer_portal_ready, serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, files, (GDestroyNotify) g_ptr_array_unref);
|
||||
}
|
||||
|
||||
/* deserializer */
|
||||
|
||||
static void
|
||||
portal_finish (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
file_transfer_portal_finish (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
char **files = NULL;
|
||||
GError *error = NULL;
|
||||
@@ -452,9 +452,9 @@ portal_finish (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
portal_file_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
file_transfer_portal_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -487,12 +487,12 @@ portal_file_deserializer_finish (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
file_transfer_portal_retrieve_files (key, portal_finish, deserializer);
|
||||
file_transfer_portal_retrieve_files (key, file_transfer_portal_finish, deserializer);
|
||||
gdk_content_deserializer_set_task_data (deserializer, key, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
portal_file_deserializer (GdkContentDeserializer *deserializer)
|
||||
file_transfer_portal_deserializer (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
|
||||
@@ -503,43 +503,43 @@ portal_file_deserializer (GdkContentDeserializer *deserializer)
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
portal_file_deserializer_finish,
|
||||
file_transfer_portal_deserializer_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_closed (GDBusConnection *connection,
|
||||
gboolean remote_peer_vanished,
|
||||
GError *error)
|
||||
file_transfer_portal_connection_closed (GDBusConnection *connection,
|
||||
gboolean remote_peer_vanished,
|
||||
GError *error)
|
||||
{
|
||||
g_clear_object (&file_transfer_proxy);
|
||||
}
|
||||
|
||||
static void
|
||||
finish_registration (void)
|
||||
file_transfer_portal_finish_registration (void)
|
||||
{
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
file_transfer_portal_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
file_transfer_portal_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
portal_file_deserializer,
|
||||
file_transfer_portal_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
G_TYPE_FILE,
|
||||
portal_file_deserializer,
|
||||
file_transfer_portal_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
@@ -549,35 +549,35 @@ finish_registration (void)
|
||||
*/
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
file_transfer_portal_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
file_transfer_portal_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.files",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
portal_file_deserializer,
|
||||
file_transfer_portal_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.files",
|
||||
G_TYPE_FILE,
|
||||
portal_file_deserializer,
|
||||
file_transfer_portal_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Free the singleton when the connection closes, important for test */
|
||||
g_signal_connect (g_dbus_proxy_get_connection (G_DBUS_PROXY (file_transfer_proxy)),
|
||||
"closed", G_CALLBACK (connection_closed), NULL);
|
||||
"closed", G_CALLBACK (file_transfer_portal_connection_closed), NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
proxy_has_owner (GDBusProxy *proxy)
|
||||
file_transfer_portal_proxy_has_owner (GDBusProxy *proxy)
|
||||
{
|
||||
char *owner;
|
||||
|
||||
@@ -611,11 +611,11 @@ file_transfer_portal_register (void)
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if (file_transfer_proxy && !proxy_has_owner (file_transfer_proxy))
|
||||
if (file_transfer_proxy && !file_transfer_portal_proxy_has_owner (file_transfer_proxy))
|
||||
g_clear_object (&file_transfer_proxy);
|
||||
|
||||
if (file_transfer_proxy)
|
||||
finish_registration ();
|
||||
file_transfer_portal_finish_registration ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,22 +133,35 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
||||
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
||||
{ "gl-prefer-gl", GDK_DEBUG_GL_PREFER_GL, "Prefer GL over GLES API" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible" },
|
||||
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)" },
|
||||
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support" },
|
||||
};
|
||||
|
||||
static const GdkDebugKey gdk_feature_keys[] = {
|
||||
{ "gl", GDK_FEATURE_OPENGL, "Disable OpenGL support" },
|
||||
{ "gl-api", GDK_FEATURE_GL_API, "Disable non-GLES GL API" },
|
||||
{ "gles-api", GDK_FEATURE_GLES_API, "Disable GLES GL API" },
|
||||
{ "egl", GDK_FEATURE_EGL, "Disable EGL" },
|
||||
{ "glx", GDK_FEATURE_GLX, "Disable GLX" },
|
||||
{ "wgl", GDK_FEATURE_WGL, "Disable WGL" },
|
||||
{ "vulkan", GDK_FEATURE_VULKAN, "Disable Vulkan support" },
|
||||
{ "dmabuf", GDK_FEATURE_DMABUF, "Disable dmabuf support" },
|
||||
{ "offload", GDK_FEATURE_OFFLOAD, "Disable graphics offload" },
|
||||
{ "color-mgmt", GDK_FEATURE_COLOR_MANAGEMENT, "Disable color management" },
|
||||
};
|
||||
|
||||
|
||||
static GdkFeatures gdk_features;
|
||||
|
||||
gboolean
|
||||
gdk_has_feature (GdkFeatures features)
|
||||
{
|
||||
return (features & gdk_features) == features;
|
||||
}
|
||||
|
||||
#ifdef G_HAS_CONSTRUCTORS
|
||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||
@@ -216,6 +229,7 @@ gdk_ensure_resources (void)
|
||||
|
||||
guint
|
||||
gdk_parse_debug_var (const char *variable,
|
||||
const char *docs,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys)
|
||||
{
|
||||
@@ -276,6 +290,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
max_width = MAX (max_width, strlen (keys[i].key));
|
||||
max_width += 4;
|
||||
|
||||
fprintf (stderr, "%s\n", docs);
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
@@ -303,21 +318,26 @@ gdk_parse_debug_var (const char *variable,
|
||||
void
|
||||
gdk_pre_parse (void)
|
||||
{
|
||||
GdkFeatures disabled_features;
|
||||
|
||||
gdk_initialized = TRUE;
|
||||
|
||||
gdk_ensure_resources ();
|
||||
|
||||
_gdk_debug_flags = gdk_parse_debug_var ("GDK_DEBUG",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
"GDK_DEBUG can be set to values that make GDK print out different\n"
|
||||
"types of debugging information or change the behavior of GDK for\n"
|
||||
"debugging purposes.\n",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
/* These are global */
|
||||
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
|
||||
gdk_gl_backend_use (GDK_GL_EGL);
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX)
|
||||
gdk_gl_backend_use (GDK_GL_GLX);
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL)
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
disabled_features = gdk_parse_debug_var ("GDK_DISABLE",
|
||||
"GDK_DISABLE can be set to values which cause GDK to disable\n"
|
||||
"certain features.\n",
|
||||
gdk_feature_keys,
|
||||
G_N_ELEMENTS (gdk_feature_keys));
|
||||
|
||||
gdk_features = GDK_ALL_FEATURES & ~disabled_features;
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_and_unset_environment ();
|
||||
|
||||
+10
-10
@@ -49,21 +49,21 @@
|
||||
* ```
|
||||
*/
|
||||
|
||||
static void gdk_app_launch_context_finalize (GObject *object);
|
||||
static void gdk_app_launch_context_finalize (GObject *object);
|
||||
static char * gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
|
||||
GAppInfo *info,
|
||||
GList *files);
|
||||
static char * gdk_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
|
||||
GAppInfo *info,
|
||||
GList *files);
|
||||
static void gdk_app_launch_context_launch_failed (GAppLaunchContext *context,
|
||||
const char *startup_notify_id);
|
||||
static void gdk_app_launch_context_launch_failed (GAppLaunchContext *context,
|
||||
const char *startup_notify_id);
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_DISPLAY
|
||||
GDK_APP_LAUNCH_CONTEXT_PROP_0,
|
||||
GDK_APP_LAUNCH_CONTEXT_PROP_DISPLAY
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkAppLaunchContext, gdk_app_launch_context, G_TYPE_APP_LAUNCH_CONTEXT)
|
||||
@@ -78,7 +78,7 @@ gdk_app_launch_context_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_APP_LAUNCH_CONTEXT_PROP_DISPLAY:
|
||||
g_value_set_object (value, context->display);
|
||||
break;
|
||||
default:
|
||||
@@ -96,7 +96,7 @@ gdk_app_launch_context_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_APP_LAUNCH_CONTEXT_PROP_DISPLAY:
|
||||
context->display = g_value_dup_object (value);
|
||||
break;
|
||||
default:
|
||||
@@ -120,11 +120,11 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
|
||||
context_class->launch_failed = gdk_app_launch_context_launch_failed;
|
||||
|
||||
/**
|
||||
* GdkAppLaunchContext:display: (attributes org.gtk.Property.get=gdk_app_launch_context_get_display)
|
||||
* GdkAppLaunchContext:display:
|
||||
*
|
||||
* The display that the `GdkAppLaunchContext` is on.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_DISPLAY,
|
||||
g_object_class_install_property (gobject_class, GDK_APP_LAUNCH_CONTEXT_PROP_DISPLAY,
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||
@@ -169,7 +169,7 @@ gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_app_launch_context_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_app_launch_context_get_display:
|
||||
* @context: a `GdkAppLaunchContext`
|
||||
*
|
||||
* Gets the `GdkDisplay` that @context is for.
|
||||
|
||||
@@ -82,8 +82,10 @@ gdk_cairo_context_cairo_create (GdkCairoContext *self)
|
||||
|
||||
draw_context = GDK_DRAW_CONTEXT (self);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (!gdk_draw_context_is_in_frame (draw_context))
|
||||
return NULL;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
cr = GDK_CAIRO_CONTEXT_GET_CLASS (self)->cairo_create (self);
|
||||
|
||||
|
||||
+23
-24
@@ -65,15 +65,15 @@ G_DEFINE_TYPE (GdkCicpParams, gdk_cicp_params, G_TYPE_OBJECT)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_COLOR_PRIMARIES = 1,
|
||||
PROP_TRANSFER_FUNCTION,
|
||||
PROP_MATRIX_COEFFICIENTS,
|
||||
PROP_RANGE,
|
||||
GDK_CICP_PARAMS_PROP_COLOR_PRIMARIES = 1,
|
||||
GDK_CICP_PARAMS_PROP_TRANSFER_FUNCTION,
|
||||
GDK_CICP_PARAMS_PROP_MATRIX_COEFFICIENTS,
|
||||
GDK_CICP_PARAMS_PROP_RANGE,
|
||||
|
||||
N_PROPERTIES,
|
||||
GDK_CICP_PARAMS_N_PROPERTIES,
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static GParamSpec *gdk_cicp_params_properties[GDK_CICP_PARAMS_N_PROPERTIES] = { NULL, };
|
||||
|
||||
static void
|
||||
gdk_cicp_params_init (GdkCicpParams *self)
|
||||
@@ -94,19 +94,19 @@ gdk_cicp_params_get_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR_PRIMARIES:
|
||||
case GDK_CICP_PARAMS_PROP_COLOR_PRIMARIES:
|
||||
g_value_set_uint (value, self->cicp.color_primaries);
|
||||
break;
|
||||
|
||||
case PROP_TRANSFER_FUNCTION:
|
||||
case GDK_CICP_PARAMS_PROP_TRANSFER_FUNCTION:
|
||||
g_value_set_uint (value, self->cicp.transfer_function);
|
||||
break;
|
||||
|
||||
case PROP_MATRIX_COEFFICIENTS:
|
||||
case GDK_CICP_PARAMS_PROP_MATRIX_COEFFICIENTS:
|
||||
g_value_set_uint (value, self->cicp.matrix_coefficients);
|
||||
break;
|
||||
|
||||
case PROP_RANGE:
|
||||
case GDK_CICP_PARAMS_PROP_RANGE:
|
||||
g_value_set_enum (value, self->cicp.range);
|
||||
break;
|
||||
|
||||
@@ -126,19 +126,19 @@ gdk_cicp_params_set_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR_PRIMARIES:
|
||||
case GDK_CICP_PARAMS_PROP_COLOR_PRIMARIES:
|
||||
gdk_cicp_params_set_color_primaries (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_TRANSFER_FUNCTION:
|
||||
case GDK_CICP_PARAMS_PROP_TRANSFER_FUNCTION:
|
||||
gdk_cicp_params_set_transfer_function (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_MATRIX_COEFFICIENTS:
|
||||
case GDK_CICP_PARAMS_PROP_MATRIX_COEFFICIENTS:
|
||||
gdk_cicp_params_set_matrix_coefficients (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_RANGE:
|
||||
case GDK_CICP_PARAMS_PROP_RANGE:
|
||||
gdk_cicp_params_set_range (self, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
@@ -168,12 +168,11 @@ gdk_cicp_params_class_init (GdkCicpParamsClass *klass)
|
||||
* - 5: PAL
|
||||
* - 6,7: BT.601 / NTSC
|
||||
* - 9: BT.2020
|
||||
* - 10: CIE XYZ
|
||||
* - 12: Display P3
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_PRIMARIES] =
|
||||
gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_COLOR_PRIMARIES] =
|
||||
g_param_spec_uint ("color-primaries", NULL, NULL,
|
||||
0, 255, 2,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -196,7 +195,7 @@ gdk_cicp_params_class_init (GdkCicpParamsClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_TRANSFER_FUNCTION] =
|
||||
gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_TRANSFER_FUNCTION] =
|
||||
g_param_spec_uint ("transfer-function", NULL, NULL,
|
||||
0, 255, 2,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -213,7 +212,7 @@ gdk_cicp_params_class_init (GdkCicpParamsClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_MATRIX_COEFFICIENTS] =
|
||||
gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_MATRIX_COEFFICIENTS] =
|
||||
g_param_spec_uint ("matrix-coefficients", NULL, NULL,
|
||||
0, 255, 2,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -227,13 +226,13 @@ gdk_cicp_params_class_init (GdkCicpParamsClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_RANGE] =
|
||||
gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_RANGE] =
|
||||
g_param_spec_enum ("range", NULL, NULL,
|
||||
GDK_TYPE_CICP_RANGE,
|
||||
GDK_CICP_RANGE_NARROW,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
g_object_class_install_properties (object_class, GDK_CICP_PARAMS_N_PROPERTIES, gdk_cicp_params_properties);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -295,7 +294,7 @@ gdk_cicp_params_set_color_primaries (GdkCicpParams *self,
|
||||
return;
|
||||
|
||||
self->cicp.color_primaries = color_primaries;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_COLOR_PRIMARIES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_COLOR_PRIMARIES]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -335,7 +334,7 @@ gdk_cicp_params_set_transfer_function (GdkCicpParams *self,
|
||||
return;
|
||||
|
||||
self->cicp.transfer_function = transfer_function;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TRANSFER_FUNCTION]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_TRANSFER_FUNCTION]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -375,7 +374,7 @@ gdk_cicp_params_set_matrix_coefficients (GdkCicpParams *self,
|
||||
return;
|
||||
|
||||
self->cicp.matrix_coefficients = matrix_coefficients;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MATRIX_COEFFICIENTS]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_MATRIX_COEFFICIENTS]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -415,7 +414,7 @@ gdk_cicp_params_set_range (GdkCicpParams *self,
|
||||
return;
|
||||
|
||||
self->cicp.range = range;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_RANGE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_cicp_params_properties[GDK_CICP_PARAMS_PROP_RANGE]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ void gdk_cicp_params_set_matrix_coefficients (GdkCicpParams *self,
|
||||
/**
|
||||
* GdkCicpRange:
|
||||
* @GDK_CICP_RANGE_NARROW: The values use the range of 16-235 (for Y) and 16-240 for u and v.
|
||||
* @GDK_CICO_RANGE_FULL: The values use the full range.
|
||||
* @GDK_CICP_RANGE_FULL: The values use the full range.
|
||||
*
|
||||
* The values of this enumeration describe whether image data uses
|
||||
* the full range of 8-bit values.
|
||||
|
||||
+35
-35
@@ -67,21 +67,21 @@ struct _GdkClipboardPrivate
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
PROP_FORMATS,
|
||||
PROP_LOCAL,
|
||||
PROP_CONTENT,
|
||||
N_PROPERTIES
|
||||
GDK_CLIPBOARD_PROP_0,
|
||||
GDK_CLIPBOARD_PROP_DISPLAY,
|
||||
GDK_CLIPBOARD_PROP_FORMATS,
|
||||
GDK_CLIPBOARD_PROP_LOCAL,
|
||||
GDK_CLIPBOARD_PROP_CONTENT,
|
||||
GDK_CLIPBOARD_N_PROPERTIES
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
N_SIGNALS
|
||||
GDK_CLIPBOARD_CHANGED,
|
||||
GDK_CLIPBOARD_N_SIGNALS
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GParamSpec *gdk_clipboard_properties[GDK_CLIPBOARD_N_PROPERTIES] = { NULL, };
|
||||
static guint gdk_clipboard_signals[GDK_CLIPBOARD_N_SIGNALS] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GdkClipboard, gdk_clipboard, G_TYPE_OBJECT)
|
||||
|
||||
@@ -96,7 +96,7 @@ gdk_clipboard_set_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_CLIPBOARD_PROP_DISPLAY:
|
||||
priv->display = g_value_get_object (value);
|
||||
g_assert (priv->display != NULL);
|
||||
break;
|
||||
@@ -118,19 +118,19 @@ gdk_clipboard_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_CLIPBOARD_PROP_DISPLAY:
|
||||
g_value_set_object (value, priv->display);
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
case GDK_CLIPBOARD_PROP_FORMATS:
|
||||
g_value_set_boxed (value, priv->formats);
|
||||
break;
|
||||
|
||||
case PROP_CONTENT:
|
||||
case GDK_CLIPBOARD_PROP_CONTENT:
|
||||
g_value_set_object (value, priv->content);
|
||||
break;
|
||||
|
||||
case PROP_LOCAL:
|
||||
case GDK_CLIPBOARD_PROP_LOCAL:
|
||||
g_value_set_boolean (value, priv->local);
|
||||
break;
|
||||
|
||||
@@ -169,11 +169,11 @@ gdk_clipboard_real_claim (GdkClipboard *clipboard,
|
||||
gdk_content_formats_ref (formats);
|
||||
formats = gdk_content_formats_union_deserialize_gtypes (formats);
|
||||
priv->formats = formats;
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), properties[PROP_FORMATS]);
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), gdk_clipboard_properties[GDK_CLIPBOARD_PROP_FORMATS]);
|
||||
if (priv->local != local)
|
||||
{
|
||||
priv->local = local;
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), properties[PROP_LOCAL]);
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), gdk_clipboard_properties[GDK_CLIPBOARD_PROP_LOCAL]);
|
||||
}
|
||||
|
||||
if (priv->content != content)
|
||||
@@ -202,12 +202,12 @@ gdk_clipboard_real_claim (GdkClipboard *clipboard,
|
||||
clipboard);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), properties[PROP_CONTENT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), gdk_clipboard_properties[GDK_CLIPBOARD_PROP_CONTENT]);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (clipboard));
|
||||
|
||||
g_signal_emit (clipboard, signals[CHANGED], 0);
|
||||
g_signal_emit (clipboard, gdk_clipboard_signals[GDK_CLIPBOARD_CHANGED], 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -353,11 +353,11 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
class->read_finish = gdk_clipboard_read_local_finish;
|
||||
|
||||
/**
|
||||
* GdkClipboard:display: (attributes org.gtk.Property.get=gdk_clipboard_get_display)
|
||||
* GdkClipboard:display:
|
||||
*
|
||||
* The `GdkDisplay` that the clipboard belongs to.
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
gdk_clipboard_properties[GDK_CLIPBOARD_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -366,11 +366,11 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkClipboard:formats: (attributes org.gtk.Property.get=gdk_clipboard_get_formats)
|
||||
* GdkClipboard:formats:
|
||||
*
|
||||
* The possible formats that the clipboard can provide its data in.
|
||||
*/
|
||||
properties[PROP_FORMATS] =
|
||||
gdk_clipboard_properties[GDK_CLIPBOARD_PROP_FORMATS] =
|
||||
g_param_spec_boxed ("formats", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_FORMATS,
|
||||
G_PARAM_READABLE |
|
||||
@@ -378,11 +378,11 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkClipboard:local: (attributes org.gtk.Property.get=gdk_clipboard_is_local)
|
||||
* GdkClipboard:local: (getter is_local)
|
||||
*
|
||||
* %TRUE if the contents of the clipboard are owned by this process.
|
||||
*/
|
||||
properties[PROP_LOCAL] =
|
||||
gdk_clipboard_properties[GDK_CLIPBOARD_PROP_LOCAL] =
|
||||
g_param_spec_boolean ("local", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE |
|
||||
@@ -390,12 +390,12 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkClipboard:content: (attributes org.gtk.Property.get=gdk_clipboard_get_content)
|
||||
* GdkClipboard:content:
|
||||
*
|
||||
* The `GdkContentProvider` or %NULL if the clipboard is empty or contents are
|
||||
* provided otherwise.
|
||||
*/
|
||||
properties[PROP_CONTENT] =
|
||||
gdk_clipboard_properties[GDK_CLIPBOARD_PROP_CONTENT] =
|
||||
g_param_spec_object ("content", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_PROVIDER,
|
||||
G_PARAM_READABLE |
|
||||
@@ -408,7 +408,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
*
|
||||
* Emitted when the clipboard changes ownership.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
gdk_clipboard_signals[GDK_CLIPBOARD_CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -416,7 +416,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
g_object_class_install_properties (object_class, GDK_CLIPBOARD_N_PROPERTIES, gdk_clipboard_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -429,7 +429,7 @@ gdk_clipboard_init (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_clipboard_get_display:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Gets the `GdkDisplay` that the clipboard was created for.
|
||||
@@ -447,7 +447,7 @@ gdk_clipboard_get_display (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_get_formats: (attributes org.gtk.Method.get_property=formats)
|
||||
* gdk_clipboard_get_formats:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Gets the formats that the clipboard can provide its current contents in.
|
||||
@@ -465,7 +465,7 @@ gdk_clipboard_get_formats (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_is_local: (attributes org.gtk.Method.get_property=local)
|
||||
* gdk_clipboard_is_local: (get-property local)
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Returns if the clipboard is local.
|
||||
@@ -489,7 +489,7 @@ gdk_clipboard_is_local (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_get_content: (attributes org.gtk.Method.get_property=content)
|
||||
* gdk_clipboard_get_content:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Returns the `GdkContentProvider` currently set on @clipboard.
|
||||
@@ -743,7 +743,7 @@ gdk_clipboard_read_value_got_stream (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
free_value (gpointer value)
|
||||
gdk_clipboard_free_value (gpointer value)
|
||||
{
|
||||
g_value_unset (value);
|
||||
g_free (value);
|
||||
@@ -769,7 +769,7 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
g_task_set_source_tag (task, source_tag);
|
||||
value = g_new0 (GValue, 1);
|
||||
g_value_init (value, type);
|
||||
g_task_set_task_data (task, value, free_value);
|
||||
g_task_set_task_data (task, value, gdk_clipboard_free_value);
|
||||
|
||||
if (priv->local)
|
||||
{
|
||||
|
||||
@@ -229,20 +229,6 @@ gdk_color_from_rgba (GdkColor *self,
|
||||
gdk_color_finish (&tmp);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_get_depth:
|
||||
* @self: a `GdkColor`
|
||||
*
|
||||
* Returns the preferred depth for the color state of @self.
|
||||
*
|
||||
* Returns: the preferred depth
|
||||
*/
|
||||
GdkMemoryDepth
|
||||
(gdk_color_get_depth) (const GdkColor *self)
|
||||
{
|
||||
return gdk_color_state_get_depth (self->color_state);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_print:
|
||||
* @self: the `GdkColor` to print
|
||||
|
||||
+29
-21
@@ -20,11 +20,17 @@
|
||||
* and tests, and must not include other headers.
|
||||
*/
|
||||
|
||||
static inline int
|
||||
sign (float v)
|
||||
{
|
||||
return v < 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
static inline float
|
||||
srgb_oetf (float v)
|
||||
{
|
||||
if (v > 0.0031308f)
|
||||
return 1.055f * powf (v, 1.f / 2.4f) - 0.055f;
|
||||
if (fabsf (v) > 0.0031308f)
|
||||
return sign (v) * (1.055f * powf (fabsf (v), 1.f / 2.4f) - 0.055f);
|
||||
else
|
||||
return 12.92f * v;
|
||||
}
|
||||
@@ -32,8 +38,8 @@ srgb_oetf (float v)
|
||||
static inline float
|
||||
srgb_eotf (float v)
|
||||
{
|
||||
if (v >= 0.04045f)
|
||||
return powf (((v + 0.055f) / (1.f + 0.055f)), 2.4f);
|
||||
if (fabsf (v) >= 0.04045f)
|
||||
return sign (v) * powf (((fabsf (v) + 0.055f) / (1.f + 0.055f)), 2.4f);
|
||||
else
|
||||
return v / 12.92f;
|
||||
}
|
||||
@@ -41,25 +47,25 @@ srgb_eotf (float v)
|
||||
static inline float
|
||||
gamma22_oetf (float v)
|
||||
{
|
||||
return powf (v, 1.f / 2.2f);
|
||||
return sign (v) * powf (fabsf (v), 1.f / 2.2f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma22_eotf (float v)
|
||||
{
|
||||
return powf (v, 2.2f);
|
||||
return sign (v) * powf (fabsf (v), 2.2f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma28_oetf (float v)
|
||||
{
|
||||
return powf (v, 1.f / 2.8f);
|
||||
return sign (v) * powf (fabsf (v), 1.f / 2.8f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma28_eotf (float v)
|
||||
{
|
||||
return powf (v, 2.8f);
|
||||
return sign (v) * powf (fabsf (v), 2.8f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
@@ -71,9 +77,10 @@ pq_eotf (float v)
|
||||
float c2 = 2413.0 / (1 << 7);
|
||||
float c3 = 2392.0 / (1 << 7);
|
||||
|
||||
float x = powf (MAX ((powf (v, minv) - c1), 0) / (c2 - (c3 * (powf (v, minv)))), ninv);
|
||||
float x = powf (fabsf (v), minv);
|
||||
x = powf (MAX ((x - c1), 0) / (c2 - (c3 * x)), ninv);
|
||||
|
||||
return x * 10000 / 203.0;
|
||||
return sign (v) * x * 10000 / 203.0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
@@ -86,7 +93,8 @@ pq_oetf (float v)
|
||||
float c2 = 2413.0 / (1 << 7);
|
||||
float c3 = 2392.0 / (1 << 7);
|
||||
|
||||
return powf (((c1 + (c2 * powf (x, n))) / (1 + (c3 * powf (x, n)))), m);
|
||||
x = powf (fabsf (x), n);
|
||||
return sign (v) * powf (((c1 + (c2 * x)) / (1 + (c3 * x))), m);
|
||||
}
|
||||
|
||||
static inline float
|
||||
@@ -95,10 +103,10 @@ bt709_eotf (float v)
|
||||
const float a = 1.099;
|
||||
const float d = 0.0812;
|
||||
|
||||
if (v < d)
|
||||
if (fabsf (v) < d)
|
||||
return v / 4.5f;
|
||||
else
|
||||
return powf ((v + (a - 1)) / a, 1 / 0.45f);
|
||||
return sign (v) * powf ((fabsf (v) + (a - 1)) / a, 1 / 0.45f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
@@ -107,10 +115,10 @@ bt709_oetf (float v)
|
||||
const float a = 1.099;
|
||||
const float b = 0.018;
|
||||
|
||||
if (v < b)
|
||||
if (fabsf (v) < b)
|
||||
return v * 4.5f;
|
||||
else
|
||||
return a * powf (v, 0.45f) - (a - 1);
|
||||
return sign (v) * (a * powf (fabsf (v), 0.45f) - (a - 1));
|
||||
}
|
||||
|
||||
static inline float
|
||||
@@ -120,10 +128,10 @@ hlg_eotf (float v)
|
||||
const float b = 0.28466892;
|
||||
const float c = 0.55991073;
|
||||
|
||||
if (v <= 0.5)
|
||||
return (v * v) / 3;
|
||||
if (fabsf (v) <= 0.5)
|
||||
return sign (v) * (v * v) / 3;
|
||||
else
|
||||
return (expf ((v - c) / a) + b) / 12.0;
|
||||
return sign (v) * (expf ((fabsf (v) - c) / a) + b) / 12.0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
@@ -133,10 +141,10 @@ hlg_oetf (float v)
|
||||
const float b = 0.28466892;
|
||||
const float c = 0.55991073;
|
||||
|
||||
if (v <= 1/12.0)
|
||||
return sqrtf (3 * v);
|
||||
if (fabsf (v) <= 1/12.0)
|
||||
return sign (v) * sqrtf (3 * fabsf (v));
|
||||
else
|
||||
return a * logf (12 * v - b) + c;
|
||||
return sign (v) * (a * logf (12 * fabsf (v) - b) + c);
|
||||
}
|
||||
|
||||
/* See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
|
||||
|
||||
+4
-8
@@ -116,7 +116,10 @@ _gdk_color_to_float (const GdkColor *self,
|
||||
{
|
||||
if (gdk_color_state_equal (self->color_state, color_state))
|
||||
{
|
||||
memcpy (values, self->values, sizeof (float) * 4);
|
||||
values[0] = self->values[0];
|
||||
values[1] = self->values[1];
|
||||
values[2] = self->values[2];
|
||||
values[3] = self->values[3];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,10 +129,3 @@ _gdk_color_to_float (const GdkColor *self,
|
||||
values);
|
||||
}
|
||||
|
||||
#define gdk_color_get_depth(self) _gdk_color_get_depth ((self))
|
||||
static inline GdkMemoryDepth
|
||||
_gdk_color_get_depth (const GdkColor *self)
|
||||
{
|
||||
return gdk_color_state_get_depth (self->color_state);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ gboolean gdk_color_equal (const GdkColor *color1,
|
||||
const GdkColor *color2);
|
||||
gboolean gdk_color_is_clear (const GdkColor *self);
|
||||
gboolean gdk_color_is_opaque (const GdkColor *self);
|
||||
GdkMemoryDepth gdk_color_get_depth (const GdkColor *self);
|
||||
|
||||
void gdk_color_convert (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
|
||||
+115
-32
@@ -38,9 +38,9 @@
|
||||
* Crucially, GTK knows how to convert colors from one color
|
||||
* state to another.
|
||||
*
|
||||
* `GdkColorState objects are immutable and therefore threadsafe.
|
||||
* `GdkColorState` objects are immutable and therefore threadsafe.
|
||||
*
|
||||
* Since 4.16
|
||||
* Since: 4.16
|
||||
*/
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkColorState, gdk_color_state,
|
||||
@@ -331,6 +331,68 @@ gdk_default_color_state_get_cicp (GdkColorState *color_state)
|
||||
return &self->cicp;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_color_state_check_inf_nan (const float src[4],
|
||||
float dest[4])
|
||||
{
|
||||
if (isnan (src[0]) ||
|
||||
isnan (src[1]) ||
|
||||
isnan (src[2]) ||
|
||||
isnan (src[3]))
|
||||
{
|
||||
dest = (float[4]) { 1.0, 0.0, 0.8, 1.0 };
|
||||
return TRUE;
|
||||
}
|
||||
if (isinf (src[0]) ||
|
||||
isinf (src[1]) ||
|
||||
isinf (src[2]) ||
|
||||
isinf (src[3]))
|
||||
{
|
||||
dest = (float[4]) { 0.0, 0.8, 1.0, 1.0 };
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_color_state_clamp_0_1 (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4])
|
||||
{
|
||||
if (gdk_color_state_check_inf_nan (src, dest))
|
||||
return;
|
||||
|
||||
dest[0] = CLAMP (src[0], 0.0f, 1.0f);
|
||||
dest[1] = CLAMP (src[1], 0.0f, 1.0f);
|
||||
dest[2] = CLAMP (src[2], 0.0f, 1.0f);
|
||||
dest[3] = CLAMP (src[3], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_color_state_clamp_unbounded (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4])
|
||||
{
|
||||
if (gdk_color_state_check_inf_nan (src, dest))
|
||||
return;
|
||||
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
dest[3] = CLAMP (src[3], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_default_color_state_clamp (GdkColorState *color_state,
|
||||
const float in[4],
|
||||
float out[4])
|
||||
{
|
||||
GdkDefaultColorState *self = (GdkDefaultColorState *) color_state;
|
||||
|
||||
self->clamp (color_state, in, out);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
static const
|
||||
@@ -342,6 +404,7 @@ GdkColorStateClass GDK_DEFAULT_COLOR_STATE_CLASS = {
|
||||
.get_convert_to = gdk_default_color_state_get_convert_to,
|
||||
.get_convert_from = gdk_default_color_state_get_convert_from,
|
||||
.get_cicp = gdk_default_color_state_get_cicp,
|
||||
.clamp = gdk_default_color_state_clamp,
|
||||
};
|
||||
|
||||
GdkDefaultColorState gdk_default_color_states[] = {
|
||||
@@ -350,7 +413,8 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_U8_SRGB,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
},
|
||||
.name = "srgb",
|
||||
.no_srgb = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
@@ -359,6 +423,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_to_rec2100_linear,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
.cicp = { 1, 13, 0, 1 },
|
||||
},
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = {
|
||||
@@ -367,6 +432,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_U8,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
},
|
||||
.name = "srgb-linear",
|
||||
.no_srgb = NULL,
|
||||
@@ -375,6 +441,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_linear_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_linear_to_rec2100_linear,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
.cicp = { 1, 8, 0, 1 },
|
||||
},
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = {
|
||||
@@ -382,7 +449,8 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_FLOAT16,
|
||||
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
},
|
||||
.name = "rec2100-pq",
|
||||
.no_srgb = NULL,
|
||||
@@ -391,6 +459,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_pq_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_rec2100_pq_to_rec2100_linear,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
.cicp = { 9, 16, 0, 1 },
|
||||
},
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = {
|
||||
@@ -399,6 +468,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_FLOAT16,
|
||||
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
},
|
||||
.name = "rec2100-linear",
|
||||
.no_srgb = NULL,
|
||||
@@ -407,11 +477,12 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_linear_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_rec2100_linear_to_rec2100_pq,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_unbounded,
|
||||
.cicp = { 9, 8, 0, 1 },
|
||||
},
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
/* {{{ Cicp implementation */
|
||||
|
||||
typedef struct _GdkCicpColorState GdkCicpColorState;
|
||||
@@ -421,15 +492,15 @@ struct _GdkCicpColorState
|
||||
|
||||
GdkColorState *no_srgb;
|
||||
|
||||
const char *name;
|
||||
char *name;
|
||||
|
||||
GdkTransferFunc eotf;
|
||||
GdkTransferFunc oetf;
|
||||
|
||||
float *to_srgb;
|
||||
float *to_rec2020;
|
||||
float *from_srgb;
|
||||
float *from_rec2020;
|
||||
float to_srgb[9];
|
||||
float to_rec2020[9];
|
||||
float from_srgb[9];
|
||||
float from_rec2020[9];
|
||||
|
||||
GdkCicp cicp;
|
||||
};
|
||||
@@ -449,7 +520,6 @@ TRANSFORM(gdk_cicp_from_rec2100_linear, NONE, cicp->from_rec2020, cicp->o
|
||||
|
||||
#undef cicp
|
||||
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
/* {{{ Vfuncs */
|
||||
|
||||
@@ -458,14 +528,11 @@ gdk_cicp_color_state_free (GdkColorState *cs)
|
||||
{
|
||||
GdkCicpColorState *self = (GdkCicpColorState *) cs;
|
||||
|
||||
g_free (self->name);
|
||||
|
||||
if (self->no_srgb)
|
||||
gdk_color_state_unref (self->no_srgb);
|
||||
|
||||
g_free (self->to_srgb);
|
||||
g_free (self->to_rec2020);
|
||||
g_free (self->from_srgb);
|
||||
g_free (self->from_rec2020);
|
||||
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
@@ -555,7 +622,7 @@ gdk_cicp_color_state_get_cicp (GdkColorState *color_state)
|
||||
return &self->cicp;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
|
||||
static const
|
||||
GdkColorStateClass GDK_CICP_COLOR_STATE_CLASS = {
|
||||
@@ -566,6 +633,7 @@ GdkColorStateClass GDK_CICP_COLOR_STATE_CLASS = {
|
||||
.get_convert_to = gdk_cicp_color_state_get_convert_to,
|
||||
.get_convert_from = gdk_cicp_color_state_get_convert_from,
|
||||
.get_cicp = gdk_cicp_color_state_get_cicp,
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
};
|
||||
|
||||
static inline float *
|
||||
@@ -676,10 +744,6 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
to_xyz = rec2020_to_xyz;
|
||||
from_xyz = xyz_to_rec2020;
|
||||
break;
|
||||
case 10:
|
||||
to_xyz = identity;
|
||||
from_xyz = identity;
|
||||
break;
|
||||
case 12:
|
||||
to_xyz = p3_to_xyz;
|
||||
from_xyz = xyz_to_p3;
|
||||
@@ -698,7 +762,8 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
self->parent.ref_count = 1;
|
||||
|
||||
/* sRGB is special-cased by being a default colorstate */
|
||||
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR;
|
||||
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ;
|
||||
self->parent.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR;
|
||||
|
||||
self->parent.depth = GDK_MEMORY_FLOAT16;
|
||||
|
||||
@@ -707,10 +772,10 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
self->eotf = eotf;
|
||||
self->oetf = oetf;
|
||||
|
||||
self->to_srgb = multiply (g_new (float, 9), xyz_to_srgb, to_xyz);
|
||||
self->to_rec2020 = multiply (g_new (float, 9), xyz_to_rec2020, to_xyz);
|
||||
self->from_srgb = multiply (g_new (float, 9), from_xyz, srgb_to_xyz);
|
||||
self->from_rec2020 = multiply (g_new (float, 9), from_xyz, rec2020_to_xyz);
|
||||
multiply (self->to_srgb, xyz_to_srgb, to_xyz);
|
||||
multiply (self->to_rec2020, xyz_to_rec2020, to_xyz);
|
||||
multiply (self->from_srgb, from_xyz, srgb_to_xyz);
|
||||
multiply (self->from_rec2020, from_xyz, rec2020_to_xyz);
|
||||
|
||||
self->name = g_strdup_printf ("cicp-%u/%u/%u/%u",
|
||||
cicp->color_primaries,
|
||||
@@ -720,12 +785,12 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
|
||||
if (cicp->transfer_function == 13)
|
||||
{
|
||||
GdkCicp no_srgb;
|
||||
|
||||
memcpy (&no_srgb, cicp, sizeof (GdkCicp));
|
||||
no_srgb.transfer_function = 8;
|
||||
|
||||
self->no_srgb = gdk_color_state_new_for_cicp (&no_srgb, NULL);
|
||||
self->no_srgb = gdk_color_state_new_for_cicp (&(GdkCicp) {
|
||||
cicp->color_primaries,
|
||||
8,
|
||||
cicp->matrix_coefficients,
|
||||
cicp->range },
|
||||
NULL);
|
||||
}
|
||||
|
||||
return (GdkColorState *) self;
|
||||
@@ -773,6 +838,24 @@ gdk_color_state_get_no_srgb_tf (GdkColorState *self)
|
||||
return self->klass->get_no_srgb_tf (self);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_state_clamp:
|
||||
* @self: a `GdkColorState`
|
||||
* @src: the values to clamp
|
||||
* @dest: (out): location to store the result, may be identical to
|
||||
* the src argument
|
||||
*
|
||||
* Clamps the values to be within the allowed ranges for the given
|
||||
* color state.
|
||||
*/
|
||||
void
|
||||
gdk_color_state_clamp (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4])
|
||||
{
|
||||
self->klass->clamp (self, src, dest);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -26,6 +26,7 @@ struct _GdkColorState
|
||||
|
||||
GdkMemoryDepth depth;
|
||||
GdkColorState *rendering_color_state;
|
||||
GdkColorState *rendering_color_state_linear;
|
||||
};
|
||||
|
||||
/* Note: self may be the source or the target colorstate */
|
||||
@@ -45,6 +46,9 @@ struct _GdkColorStateClass
|
||||
GdkFloatColorConvert (* get_convert_from) (GdkColorState *self,
|
||||
GdkColorState *source);
|
||||
const GdkCicp * (* get_cicp) (GdkColorState *self);
|
||||
void (* clamp) (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4]);
|
||||
};
|
||||
|
||||
typedef struct _GdkDefaultColorState GdkDefaultColorState;
|
||||
@@ -56,6 +60,9 @@ struct _GdkDefaultColorState
|
||||
const char *name;
|
||||
GdkColorState *no_srgb;
|
||||
GdkFloatColorConvert convert_to[GDK_COLOR_STATE_N_IDS];
|
||||
void (* clamp) (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4]);
|
||||
|
||||
GdkCicp cicp;
|
||||
};
|
||||
@@ -77,6 +84,10 @@ GdkColorState * gdk_color_state_get_no_srgb_tf (GdkColorState
|
||||
GdkColorState * gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
GError **error);
|
||||
|
||||
void gdk_color_state_clamp (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4]);
|
||||
|
||||
static inline GdkColorState *
|
||||
gdk_color_state_get_rendering_color_state (GdkColorState *self)
|
||||
{
|
||||
@@ -84,9 +95,9 @@ gdk_color_state_get_rendering_color_state (GdkColorState *self)
|
||||
self = GDK_COLOR_STATE_REC2100_PQ;
|
||||
|
||||
if (!GDK_DEBUG_CHECK (LINEAR))
|
||||
return self;
|
||||
return self->rendering_color_state;
|
||||
|
||||
return self->rendering_color_state;
|
||||
return self->rendering_color_state_linear;
|
||||
}
|
||||
|
||||
static inline GdkMemoryDepth
|
||||
@@ -176,7 +187,10 @@ gdk_color_state_convert_color (GdkColorState *src_cs,
|
||||
GdkFloatColorConvert convert = NULL;
|
||||
GdkFloatColorConvert convert2 = NULL;
|
||||
|
||||
memcpy (dest, src, sizeof (float) * 4);
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
dest[3] = src[3];
|
||||
|
||||
if (gdk_color_state_equal (src_cs, dest_cs))
|
||||
return;
|
||||
@@ -210,4 +224,3 @@ gdk_color_state_from_rgba (GdkColorState *self,
|
||||
self,
|
||||
out_color);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ struct _Deserializer
|
||||
GDestroyNotify notify;
|
||||
};
|
||||
|
||||
GQueue deserializers = G_QUEUE_INIT;
|
||||
GQueue gdk_content_deserializers = G_QUEUE_INIT;
|
||||
|
||||
static void init (void);
|
||||
static void gdk_content_deserializers_init (void);
|
||||
|
||||
#define GDK_CONTENT_DESERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_CONTENT_DESERIALIZER, GdkContentDeserializerClass))
|
||||
#define GDK_IS_CONTENT_DESERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_CONTENT_DESERIALIZER))
|
||||
@@ -418,22 +418,22 @@ gdk_content_register_deserializer (const char *mime_type,
|
||||
deserializer->data = data;
|
||||
deserializer->notify = notify;
|
||||
|
||||
g_queue_push_tail (&deserializers, deserializer);
|
||||
g_queue_push_tail (&gdk_content_deserializers, deserializer);
|
||||
}
|
||||
|
||||
static Deserializer *
|
||||
lookup_deserializer (const char *mime_type,
|
||||
GType type)
|
||||
gdk_content_deserializer_lookup (const char *mime_type,
|
||||
GType type)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
g_return_val_if_fail (mime_type != NULL, NULL);
|
||||
|
||||
init ();
|
||||
gdk_content_deserializers_init ();
|
||||
|
||||
mime_type = g_intern_string (mime_type);
|
||||
|
||||
for (l = g_queue_peek_head_link (&deserializers); l; l = l->next)
|
||||
for (l = g_queue_peek_head_link (&gdk_content_deserializers); l; l = l->next)
|
||||
{
|
||||
Deserializer *deserializer = l->data;
|
||||
|
||||
@@ -462,12 +462,12 @@ gdk_content_formats_union_deserialize_gtypes (GdkContentFormats *formats)
|
||||
|
||||
g_return_val_if_fail (formats != NULL, NULL);
|
||||
|
||||
init ();
|
||||
gdk_content_deserializers_init ();
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
gdk_content_formats_builder_add_formats (builder, formats);
|
||||
|
||||
for (l = g_queue_peek_head_link (&deserializers); l; l = l->next)
|
||||
for (l = g_queue_peek_head_link (&gdk_content_deserializers); l; l = l->next)
|
||||
{
|
||||
Deserializer *deserializer = l->data;
|
||||
|
||||
@@ -497,12 +497,12 @@ gdk_content_formats_union_deserialize_mime_types (GdkContentFormats *formats)
|
||||
|
||||
g_return_val_if_fail (formats != NULL, NULL);
|
||||
|
||||
init ();
|
||||
gdk_content_deserializers_init ();
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
gdk_content_formats_builder_add_formats (builder, formats);
|
||||
|
||||
for (l = g_queue_peek_head_link (&deserializers); l; l = l->next)
|
||||
for (l = g_queue_peek_head_link (&gdk_content_deserializers); l; l = l->next)
|
||||
{
|
||||
Deserializer *deserializer = l->data;
|
||||
|
||||
@@ -558,7 +558,7 @@ gdk_content_deserialize_async (GInputStream *stream,
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
deserializer = lookup_deserializer (mime_type, type);
|
||||
deserializer = gdk_content_deserializer_lookup (mime_type, type);
|
||||
|
||||
gdk_content_deserializer_run (mime_type,
|
||||
type,
|
||||
@@ -612,9 +612,9 @@ gdk_content_deserialize_finish (GAsyncResult *result,
|
||||
/*** DESERIALIZERS ***/
|
||||
|
||||
static void
|
||||
pixbuf_deserializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer deserializer)
|
||||
gdk_content_deserializer_pixbuf_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GValue *value;
|
||||
@@ -647,18 +647,18 @@ pixbuf_deserializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_deserializer (GdkContentDeserializer *deserializer)
|
||||
gdk_content_deserializer_pixbuf (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
gdk_pixbuf_new_from_stream_async (gdk_content_deserializer_get_input_stream (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
pixbuf_deserializer_finish,
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
gdk_content_deserializer_pixbuf_finish,
|
||||
deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
gdk_content_deserializer_texture_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GBytes *bytes;
|
||||
@@ -688,7 +688,7 @@ texture_deserializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
texture_deserializer (GdkContentDeserializer *deserializer)
|
||||
gdk_content_deserializer_texture (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
|
||||
@@ -700,15 +700,15 @@ texture_deserializer (GdkContentDeserializer *deserializer)
|
||||
| G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
texture_deserializer_finish,
|
||||
gdk_content_deserializer_texture_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
string_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
gdk_content_deserializer_string_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -744,7 +744,7 @@ string_deserializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
string_deserializer (GdkContentDeserializer *deserializer)
|
||||
gdk_content_deserializer_string (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output, *filter;
|
||||
GCharsetConverter *converter;
|
||||
@@ -770,15 +770,15 @@ string_deserializer (GdkContentDeserializer *deserializer)
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
string_deserializer_finish,
|
||||
gdk_content_deserializer_string_finish,
|
||||
deserializer);
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
||||
static void
|
||||
file_uri_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
gdk_content_deserializer_file_uri_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -828,7 +828,7 @@ file_uri_deserializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
file_uri_deserializer (GdkContentDeserializer *deserializer)
|
||||
gdk_content_deserializer_file_uri (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
|
||||
@@ -839,15 +839,15 @@ file_uri_deserializer (GdkContentDeserializer *deserializer)
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
file_uri_deserializer_finish,
|
||||
gdk_content_deserializer_file_uri_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
color_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
gdk_content_deserializer_color_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -883,7 +883,7 @@ color_deserializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
color_deserializer (GdkContentDeserializer *deserializer)
|
||||
gdk_content_deserializer_color (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
guint16 *data;
|
||||
@@ -896,13 +896,13 @@ color_deserializer (GdkContentDeserializer *deserializer)
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
color_deserializer_finish,
|
||||
gdk_content_deserializer_color_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
init (void)
|
||||
gdk_content_deserializers_init (void)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
GSList *formats, *f;
|
||||
@@ -915,17 +915,17 @@ init (void)
|
||||
|
||||
gdk_content_register_deserializer ("image/png",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
gdk_content_deserializer_texture,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer ("image/tiff",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
gdk_content_deserializer_texture,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer ("image/jpeg",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
gdk_content_deserializer_texture,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
@@ -948,12 +948,12 @@ init (void)
|
||||
!g_str_equal (name, "tiff"))
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_TEXTURE,
|
||||
pixbuf_deserializer,
|
||||
gdk_content_deserializer_pixbuf,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_PIXBUF,
|
||||
pixbuf_deserializer,
|
||||
gdk_content_deserializer_pixbuf,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
@@ -969,19 +969,19 @@ init (void)
|
||||
|
||||
gdk_content_register_deserializer ("text/uri-list",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
file_uri_deserializer,
|
||||
gdk_content_deserializer_file_uri,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("text/uri-list",
|
||||
G_TYPE_FILE,
|
||||
file_uri_deserializer,
|
||||
gdk_content_deserializer_file_uri,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("text/plain;charset=utf-8",
|
||||
G_TYPE_STRING,
|
||||
string_deserializer,
|
||||
gdk_content_deserializer_string,
|
||||
(gpointer) "utf-8",
|
||||
NULL);
|
||||
if (!g_get_charset (&charset))
|
||||
@@ -990,21 +990,20 @@ init (void)
|
||||
|
||||
gdk_content_register_deserializer (mime,
|
||||
G_TYPE_STRING,
|
||||
string_deserializer,
|
||||
gdk_content_deserializer_string,
|
||||
(gpointer) charset,
|
||||
g_free);
|
||||
g_free (mime);
|
||||
}
|
||||
gdk_content_register_deserializer ("text/plain",
|
||||
G_TYPE_STRING,
|
||||
string_deserializer,
|
||||
gdk_content_deserializer_string,
|
||||
(gpointer) "ASCII",
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/x-color",
|
||||
GDK_TYPE_RGBA,
|
||||
color_deserializer,
|
||||
gdk_content_deserializer_color,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -47,19 +47,19 @@ struct _GdkContentProviderPrivate
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_FORMATS,
|
||||
PROP_STORABLE_FORMATS,
|
||||
N_PROPERTIES
|
||||
GDK_CONTENT_PROVIDER_PROP_0,
|
||||
GDK_CONTENT_PROVIDER_PROP_FORMATS,
|
||||
GDK_CONTENT_PROVIDER_PROP_STORABLE_FORMATS,
|
||||
GDK_CONTENT_PROVIDER_N_PROPERTIES
|
||||
};
|
||||
|
||||
enum {
|
||||
CONTENT_CHANGED,
|
||||
N_SIGNALS
|
||||
GDK_CONTENT_PROVIDER_CONTENT_CHANGED,
|
||||
GDK_CONTENT_PROVIDER_N_SIGNALS
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GParamSpec *gdk_content_provider_properties[GDK_CONTENT_PROVIDER_N_PROPERTIES] = { NULL, };
|
||||
static guint gdk_content_provider_signals[GDK_CONTENT_PROVIDER_N_SIGNALS] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GdkContentProvider, gdk_content_provider, G_TYPE_OBJECT)
|
||||
|
||||
@@ -139,11 +139,11 @@ gdk_content_provider_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FORMATS:
|
||||
case GDK_CONTENT_PROVIDER_PROP_FORMATS:
|
||||
g_value_take_boxed (value, gdk_content_provider_ref_formats (provider));
|
||||
break;
|
||||
|
||||
case PROP_STORABLE_FORMATS:
|
||||
case GDK_CONTENT_PROVIDER_PROP_STORABLE_FORMATS:
|
||||
g_value_take_boxed (value, gdk_content_provider_ref_storable_formats (provider));
|
||||
break;
|
||||
|
||||
@@ -169,11 +169,11 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
|
||||
class->get_value = gdk_content_provider_real_get_value;
|
||||
|
||||
/**
|
||||
* GdkContentProvider:formats: (attributes org.gtk.Property.get=gdk_content_provider_ref_formats)
|
||||
* GdkContentProvider:formats: (getter ref_formats)
|
||||
*
|
||||
* The possible formats that the provider can provide its data in.
|
||||
*/
|
||||
properties[PROP_FORMATS] =
|
||||
gdk_content_provider_properties[GDK_CONTENT_PROVIDER_PROP_FORMATS] =
|
||||
g_param_spec_boxed ("formats", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_FORMATS,
|
||||
G_PARAM_READABLE |
|
||||
@@ -181,11 +181,11 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkContentProvider:storable-formats: (attributes org.gtk.Property.get=gdk_content_provider_ref_storable_formats)
|
||||
* GdkContentProvider:storable-formats: (getter ref_storable_formats)
|
||||
*
|
||||
* The subset of formats that clipboard managers should store this provider's data in.
|
||||
*/
|
||||
properties[PROP_STORABLE_FORMATS] =
|
||||
gdk_content_provider_properties[GDK_CONTENT_PROVIDER_PROP_STORABLE_FORMATS] =
|
||||
g_param_spec_boxed ("storable-formats", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_FORMATS,
|
||||
G_PARAM_READABLE |
|
||||
@@ -197,7 +197,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
|
||||
*
|
||||
* Emitted whenever the content provided by this provider has changed.
|
||||
*/
|
||||
signals[CONTENT_CHANGED] =
|
||||
gdk_content_provider_signals[GDK_CONTENT_PROVIDER_CONTENT_CHANGED] =
|
||||
g_signal_new (I_("content-changed"),
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -205,7 +205,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
g_object_class_install_properties (object_class, GDK_CONTENT_PROVIDER_N_PROPERTIES, gdk_content_provider_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -214,7 +214,7 @@ gdk_content_provider_init (GdkContentProvider *provider)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_content_provider_ref_formats: (attributes org.gtk.Method.get_property=formats)
|
||||
* gdk_content_provider_ref_formats: (get-property formats)
|
||||
* @provider: a `GdkContentProvider`
|
||||
*
|
||||
* Gets the formats that the provider can provide its current contents in.
|
||||
@@ -230,7 +230,7 @@ gdk_content_provider_ref_formats (GdkContentProvider *provider)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_content_provider_ref_storable_formats: (attributes org.gtk.Method.get_property=storable-formats)
|
||||
* gdk_content_provider_ref_storable_formats: (get-property storable-formats)
|
||||
* @provider: a `GdkContentProvider`
|
||||
*
|
||||
* Gets the formats that the provider suggests other applications to store
|
||||
@@ -261,9 +261,9 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CONTENT_PROVIDER (provider));
|
||||
|
||||
g_signal_emit (provider, signals[CONTENT_CHANGED], 0);
|
||||
g_signal_emit (provider, gdk_content_provider_signals[GDK_CONTENT_PROVIDER_CONTENT_CHANGED], 0);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (provider), properties[PROP_FORMATS]);
|
||||
g_object_notify_by_pspec (G_OBJECT (provider), gdk_content_provider_properties[GDK_CONTENT_PROVIDER_PROP_FORMATS]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+58
-59
@@ -64,9 +64,9 @@ struct _Serializer
|
||||
GDestroyNotify notify;
|
||||
};
|
||||
|
||||
GQueue serializers = G_QUEUE_INIT;
|
||||
GQueue gdk_content_serializers = G_QUEUE_INIT;
|
||||
|
||||
static void init (void);
|
||||
static void gdk_content_serializers_init (void);
|
||||
|
||||
#define GDK_CONTENT_SERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_CONTENT_SERIALIZER, GdkContentSerializerClass))
|
||||
#define GDK_IS_CONTENT_SERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_CONTENT_SERIALIZER))
|
||||
@@ -424,7 +424,7 @@ gdk_content_register_serializer (GType type,
|
||||
serializer->data = data;
|
||||
serializer->notify = notify;
|
||||
|
||||
g_queue_push_tail (&serializers, serializer);
|
||||
g_queue_push_tail (&gdk_content_serializers, serializer);
|
||||
}
|
||||
|
||||
static Serializer *
|
||||
@@ -435,11 +435,11 @@ lookup_serializer (const char *mime_type,
|
||||
|
||||
g_return_val_if_fail (mime_type != NULL, NULL);
|
||||
|
||||
init ();
|
||||
gdk_content_serializers_init ();
|
||||
|
||||
mime_type = g_intern_string (mime_type);
|
||||
|
||||
for (l = g_queue_peek_head_link (&serializers); l; l = l->next)
|
||||
for (l = g_queue_peek_head_link (&gdk_content_serializers); l; l = l->next)
|
||||
{
|
||||
Serializer *serializer = l->data;
|
||||
|
||||
@@ -468,12 +468,12 @@ gdk_content_formats_union_serialize_gtypes (GdkContentFormats *formats)
|
||||
|
||||
g_return_val_if_fail (formats != NULL, NULL);
|
||||
|
||||
init ();
|
||||
gdk_content_serializers_init ();
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
gdk_content_formats_builder_add_formats (builder, formats);
|
||||
|
||||
for (l = g_queue_peek_head_link (&serializers); l; l = l->next)
|
||||
for (l = g_queue_peek_head_link (&gdk_content_serializers); l; l = l->next)
|
||||
{
|
||||
Serializer *serializer = l->data;
|
||||
|
||||
@@ -503,12 +503,12 @@ gdk_content_formats_union_serialize_mime_types (GdkContentFormats *formats)
|
||||
|
||||
g_return_val_if_fail (formats != NULL, NULL);
|
||||
|
||||
init ();
|
||||
gdk_content_serializers_init ();
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
gdk_content_formats_builder_add_formats (builder, formats);
|
||||
|
||||
for (l = g_queue_peek_head_link (&serializers); l; l = l->next)
|
||||
for (l = g_queue_peek_head_link (&gdk_content_serializers); l; l = l->next)
|
||||
{
|
||||
Serializer *serializer = l->data;
|
||||
|
||||
@@ -610,9 +610,9 @@ gdk_content_serialize_finish (GAsyncResult *result,
|
||||
|
||||
|
||||
static void
|
||||
pixbuf_serializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer serializer)
|
||||
gdk_content_serializer_pixbuf_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer serializer)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -623,7 +623,7 @@ pixbuf_serializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_pixbuf (GdkContentSerializer *serializer)
|
||||
{
|
||||
const GValue *value;
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -652,7 +652,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gdk_content_serializer_get_output_stream (serializer),
|
||||
name,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
pixbuf_serializer_finish,
|
||||
gdk_content_serializer_pixbuf_finish,
|
||||
serializer,
|
||||
g_str_equal (name, "png") ? "compression" : NULL, "2",
|
||||
NULL);
|
||||
@@ -660,9 +660,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static void
|
||||
texture_serializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
gdk_content_serializer_texture_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentSerializer *serializer = GDK_CONTENT_SERIALIZER (source);
|
||||
GError *error = NULL;
|
||||
@@ -674,10 +674,10 @@ texture_serializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
serialize_texture_in_thread (GTask *task,
|
||||
gpointer source_object,
|
||||
gpointer task_data,
|
||||
GCancellable *cancellable)
|
||||
gdk_content_serializer_texture_in_thread (GTask *task,
|
||||
gpointer source_object,
|
||||
gpointer task_data,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GdkContentSerializer *serializer = source_object;
|
||||
const GValue *value;
|
||||
@@ -718,22 +718,22 @@ serialize_texture_in_thread (GTask *task,
|
||||
}
|
||||
|
||||
static void
|
||||
texture_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_texture (GdkContentSerializer *serializer)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (serializer,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
texture_serializer_finish,
|
||||
gdk_content_serializer_texture_finish,
|
||||
NULL);
|
||||
g_task_run_in_thread (task, serialize_texture_in_thread);
|
||||
g_task_run_in_thread (task, gdk_content_serializer_texture_in_thread);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
string_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
gdk_content_serializer_string_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -745,7 +745,7 @@ string_serializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
string_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_string (GdkContentSerializer *serializer)
|
||||
{
|
||||
GOutputStream *filter;
|
||||
GCharsetConverter *converter;
|
||||
@@ -775,15 +775,15 @@ string_serializer (GdkContentSerializer *serializer)
|
||||
strlen (text),
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
string_serializer_finish,
|
||||
gdk_content_serializer_string_finish,
|
||||
serializer);
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
||||
static void
|
||||
file_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
gdk_content_serializer_file_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -795,7 +795,7 @@ file_serializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static char *
|
||||
file_get_native_uri (GFile *file)
|
||||
gdk_file_get_native_uri (GFile *file)
|
||||
{
|
||||
char *path;
|
||||
|
||||
@@ -811,7 +811,7 @@ file_get_native_uri (GFile *file)
|
||||
}
|
||||
|
||||
static void
|
||||
file_uri_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_file_uri (GdkContentSerializer *serializer)
|
||||
{
|
||||
GFile *file;
|
||||
GString *str;
|
||||
@@ -826,7 +826,7 @@ file_uri_serializer (GdkContentSerializer *serializer)
|
||||
file = g_value_get_object (gdk_content_serializer_get_value (serializer));
|
||||
if (file)
|
||||
{
|
||||
uri = file_get_native_uri (file);
|
||||
uri = gdk_file_get_native_uri (file);
|
||||
g_string_append (str, uri);
|
||||
g_free (uri);
|
||||
}
|
||||
@@ -842,7 +842,7 @@ file_uri_serializer (GdkContentSerializer *serializer)
|
||||
|
||||
for (l = g_value_get_boxed (value); l; l = l->next)
|
||||
{
|
||||
uri = file_get_native_uri (l->data);
|
||||
uri = gdk_file_get_native_uri (l->data);
|
||||
g_string_append (str, uri);
|
||||
g_free (uri);
|
||||
g_string_append (str, "\r\n");
|
||||
@@ -854,13 +854,13 @@ file_uri_serializer (GdkContentSerializer *serializer)
|
||||
str->len,
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
file_serializer_finish,
|
||||
gdk_content_serializer_file_finish,
|
||||
serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, g_string_free (str, FALSE), g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
file_text_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_file_text (GdkContentSerializer *serializer)
|
||||
{
|
||||
const GValue *value;
|
||||
char *path = NULL;
|
||||
@@ -906,15 +906,15 @@ file_text_serializer (GdkContentSerializer *serializer)
|
||||
strlen (path),
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
file_serializer_finish,
|
||||
gdk_content_serializer_file_finish,
|
||||
serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, path, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
color_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
gdk_content_serializer_color_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
@@ -926,7 +926,7 @@ color_serializer_finish (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
color_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_color (GdkContentSerializer *serializer)
|
||||
{
|
||||
const GValue *value;
|
||||
GdkRGBA *rgba;
|
||||
@@ -948,13 +948,13 @@ color_serializer (GdkContentSerializer *serializer)
|
||||
4 * sizeof (guint16),
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
color_serializer_finish,
|
||||
gdk_content_serializer_color_finish,
|
||||
serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, data, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
init (void)
|
||||
gdk_content_serializers_init (void)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
GSList *formats, *f;
|
||||
@@ -967,17 +967,17 @@ init (void)
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/png",
|
||||
texture_serializer,
|
||||
gdk_content_serializer_texture,
|
||||
NULL, NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/tiff",
|
||||
texture_serializer,
|
||||
gdk_content_serializer_texture,
|
||||
NULL, NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/jpeg",
|
||||
texture_serializer,
|
||||
gdk_content_serializer_texture,
|
||||
NULL, NULL);
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
@@ -1001,12 +1001,12 @@ init (void)
|
||||
!g_str_equal (name, "jpeg"))
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_content_serializer_pixbuf,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
gdk_content_register_serializer (GDK_TYPE_PIXBUF,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_content_serializer_pixbuf,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
}
|
||||
@@ -1022,29 +1022,29 @@ init (void)
|
||||
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"text/uri-list",
|
||||
file_uri_serializer,
|
||||
gdk_content_serializer_file_uri,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"text/plain;charset=utf-8",
|
||||
file_text_serializer,
|
||||
gdk_content_serializer_file_text,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"text/uri-list",
|
||||
file_uri_serializer,
|
||||
gdk_content_serializer_file_uri,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"text/plain;charset=utf-8",
|
||||
file_text_serializer,
|
||||
gdk_content_serializer_file_text,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (G_TYPE_STRING,
|
||||
"text/plain;charset=utf-8",
|
||||
string_serializer,
|
||||
gdk_content_serializer_string,
|
||||
(gpointer) "utf-8",
|
||||
NULL);
|
||||
if (!g_get_charset (&charset))
|
||||
@@ -1052,21 +1052,20 @@ init (void)
|
||||
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
|
||||
gdk_content_register_serializer (G_TYPE_STRING,
|
||||
mime,
|
||||
string_serializer,
|
||||
gdk_content_serializer_string,
|
||||
(gpointer) charset,
|
||||
NULL);
|
||||
g_free (mime);
|
||||
}
|
||||
gdk_content_register_serializer (G_TYPE_STRING,
|
||||
"text/plain",
|
||||
string_serializer,
|
||||
gdk_content_serializer_string,
|
||||
(gpointer) "ASCII",
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_RGBA,
|
||||
"application/x-color",
|
||||
color_serializer,
|
||||
gdk_content_serializer_color,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
+29
-29
@@ -75,12 +75,12 @@
|
||||
*/
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_FALLBACK,
|
||||
PROP_HOTSPOT_X,
|
||||
PROP_HOTSPOT_Y,
|
||||
PROP_NAME,
|
||||
PROP_TEXTURE,
|
||||
GDK_CURSOR_PROP_0,
|
||||
GDK_CURSOR_PROP_FALLBACK,
|
||||
GDK_CURSOR_PROP_HOTSPOT_X,
|
||||
GDK_CURSOR_PROP_HOTSPOT_Y,
|
||||
GDK_CURSOR_PROP_NAME,
|
||||
GDK_CURSOR_PROP_TEXTURE,
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
|
||||
@@ -95,19 +95,19 @@ gdk_cursor_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FALLBACK:
|
||||
case GDK_CURSOR_PROP_FALLBACK:
|
||||
g_value_set_object (value, cursor->fallback);
|
||||
break;
|
||||
case PROP_HOTSPOT_X:
|
||||
case GDK_CURSOR_PROP_HOTSPOT_X:
|
||||
g_value_set_int (value, cursor->hotspot_x);
|
||||
break;
|
||||
case PROP_HOTSPOT_Y:
|
||||
case GDK_CURSOR_PROP_HOTSPOT_Y:
|
||||
g_value_set_int (value, cursor->hotspot_y);
|
||||
break;
|
||||
case PROP_NAME:
|
||||
case GDK_CURSOR_PROP_NAME:
|
||||
g_value_set_string (value, cursor->name);
|
||||
break;
|
||||
case PROP_TEXTURE:
|
||||
case GDK_CURSOR_PROP_TEXTURE:
|
||||
g_value_set_object (value, cursor->texture);
|
||||
break;
|
||||
default:
|
||||
@@ -126,19 +126,19 @@ gdk_cursor_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FALLBACK:
|
||||
case GDK_CURSOR_PROP_FALLBACK:
|
||||
cursor->fallback = g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_HOTSPOT_X:
|
||||
case GDK_CURSOR_PROP_HOTSPOT_X:
|
||||
cursor->hotspot_x = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_HOTSPOT_Y:
|
||||
case GDK_CURSOR_PROP_HOTSPOT_Y:
|
||||
cursor->hotspot_y = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_NAME:
|
||||
case GDK_CURSOR_PROP_NAME:
|
||||
cursor->name = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_TEXTURE:
|
||||
case GDK_CURSOR_PROP_TEXTURE:
|
||||
cursor->texture = g_value_dup_object (value);
|
||||
break;
|
||||
default:
|
||||
@@ -172,50 +172,50 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
||||
object_class->finalize = gdk_cursor_finalize;
|
||||
|
||||
/**
|
||||
* GdkCursor:fallback: (attributes org.gtk.Property.get=gdk_cursor_get_fallback)
|
||||
* GdkCursor:fallback:
|
||||
*
|
||||
* Cursor to fall back to if this cursor cannot be displayed.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FALLBACK,
|
||||
GDK_CURSOR_PROP_FALLBACK,
|
||||
g_param_spec_object ("fallback", NULL, NULL,
|
||||
GDK_TYPE_CURSOR,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkCursor:hotspot-x: (attributes org.gtk.Property.get=gdk_cursor_get_hotspot_x)
|
||||
* GdkCursor:hotspot-x:
|
||||
*
|
||||
* X position of the cursor hotspot in the cursor image.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HOTSPOT_X,
|
||||
GDK_CURSOR_PROP_HOTSPOT_X,
|
||||
g_param_spec_int ("hotspot-x", NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkCursor:hotspot-y: (attributes org.gtk.Property.get=gdk_cursor_get_hotspot_y)
|
||||
* GdkCursor:hotspot-y:
|
||||
*
|
||||
* Y position of the cursor hotspot in the cursor image.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HOTSPOT_Y,
|
||||
GDK_CURSOR_PROP_HOTSPOT_Y,
|
||||
g_param_spec_int ("hotspot-y", NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkCursor:name: (attributes org.gtk.Property.get=gdk_cursor_get_name)
|
||||
* GdkCursor:name:
|
||||
*
|
||||
* Name of this this cursor.
|
||||
*
|
||||
* The name will be %NULL if the cursor was created from a texture.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_NAME,
|
||||
GDK_CURSOR_PROP_NAME,
|
||||
g_param_spec_string ("name", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
@@ -229,7 +229,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
||||
* The texture will be %NULL if the cursor was created from a name.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_TEXTURE,
|
||||
GDK_CURSOR_PROP_TEXTURE,
|
||||
g_param_spec_object ("texture", NULL, NULL,
|
||||
GDK_TYPE_TEXTURE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
@@ -407,7 +407,7 @@ gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
|
||||
* gdk_cursor_get_fallback:
|
||||
* @cursor: a `GdkCursor`
|
||||
*
|
||||
* Returns the fallback for this @cursor.
|
||||
@@ -430,7 +430,7 @@ gdk_cursor_get_fallback (GdkCursor *cursor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_name: (attributes org.gtk.Method.get_property=name)
|
||||
* gdk_cursor_get_name:
|
||||
* @cursor: a `GdkCursor`
|
||||
*
|
||||
* Returns the name of the cursor.
|
||||
@@ -468,7 +468,7 @@ gdk_cursor_get_texture (GdkCursor *cursor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_hotspot_x: (attributes org.gtk.Method.get_property=hotspot-x)
|
||||
* gdk_cursor_get_hotspot_x:
|
||||
* @cursor: a `GdkCursor`
|
||||
*
|
||||
* Returns the horizontal offset of the hotspot.
|
||||
@@ -490,7 +490,7 @@ gdk_cursor_get_hotspot_x (GdkCursor *cursor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_hotspot_y: (attributes org.gtk.Method.get_property=hotspot-y)
|
||||
* gdk_cursor_get_hotspot_y:
|
||||
* @cursor: a `GdkCursor`
|
||||
*
|
||||
* Returns the vertical offset of the hotspot.
|
||||
|
||||
+25
-15
@@ -44,29 +44,38 @@ typedef enum {
|
||||
GDK_DEBUG_HDR = 1 << 14,
|
||||
GDK_DEBUG_PORTALS = 1 << 15,
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 16,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 17,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 18,
|
||||
GDK_DEBUG_FORCE_OFFLOAD = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 20,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 21,
|
||||
GDK_DEBUG_GL_PREFER_GL = 1 << 22,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 23,
|
||||
GDK_DEBUG_GL_EGL = 1 << 24,
|
||||
GDK_DEBUG_GL_GLX = 1 << 25,
|
||||
GDK_DEBUG_GL_WGL = 1 << 26,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 27,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 28,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 29,
|
||||
GDK_DEBUG_NO_VSYNC = 1 << 30,
|
||||
GDK_DEBUG_DMABUF_DISABLE = 1 << 31,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
|
||||
GDK_DEBUG_GL_PREFER_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 20,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 21,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 22,
|
||||
GDK_DEBUG_NO_VSYNC = 1 << 23,
|
||||
} GdkDebugFlags;
|
||||
|
||||
typedef enum {
|
||||
GDK_FEATURE_OPENGL = 1 << 0,
|
||||
GDK_FEATURE_GL_API = 1 << 1,
|
||||
GDK_FEATURE_GLES_API = 1 << 2,
|
||||
GDK_FEATURE_EGL = 1 << 3,
|
||||
GDK_FEATURE_GLX = 1 << 4,
|
||||
GDK_FEATURE_WGL = 1 << 5,
|
||||
GDK_FEATURE_VULKAN = 1 << 6,
|
||||
GDK_FEATURE_DMABUF = 1 << 7,
|
||||
GDK_FEATURE_OFFLOAD = 1 << 8,
|
||||
GDK_FEATURE_COLOR_MANAGEMENT = 1 << 9,
|
||||
} GdkFeatures;
|
||||
|
||||
#define GDK_ALL_FEATURES ((1 << 10) - 1)
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
||||
GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
GdkDebugFlags flags);
|
||||
|
||||
gboolean gdk_has_feature (GdkFeatures feature);
|
||||
|
||||
static inline void
|
||||
gdk_debug_message (const char *format, ...) G_GNUC_PRINTF(1, 2);
|
||||
static inline void
|
||||
@@ -106,6 +115,7 @@ typedef struct
|
||||
} GdkDebugKey;
|
||||
|
||||
guint gdk_parse_debug_var (const char *variable,
|
||||
const char *docs,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
|
||||
+97
-97
@@ -48,12 +48,12 @@ struct _GdkAxisInfo
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
TOOL_CHANGED,
|
||||
LAST_SIGNAL
|
||||
GDK_DEVICE_CHANGED,
|
||||
GDK_DEVICE_TOOL_CHANGED,
|
||||
GDK_DEVICE_LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
static guint gdk_device_signals[GDK_DEVICE_LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
static void gdk_device_finalize (GObject *object);
|
||||
@@ -71,27 +71,27 @@ static void gdk_device_get_property (GObject *object,
|
||||
G_DEFINE_ABSTRACT_TYPE (GdkDevice, gdk_device, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
PROP_NAME,
|
||||
PROP_SOURCE,
|
||||
PROP_HAS_CURSOR,
|
||||
PROP_N_AXES,
|
||||
PROP_VENDOR_ID,
|
||||
PROP_PRODUCT_ID,
|
||||
PROP_SEAT,
|
||||
PROP_NUM_TOUCHES,
|
||||
PROP_TOOL,
|
||||
PROP_DIRECTION,
|
||||
PROP_HAS_BIDI_LAYOUTS,
|
||||
PROP_CAPS_LOCK_STATE,
|
||||
PROP_NUM_LOCK_STATE,
|
||||
PROP_SCROLL_LOCK_STATE,
|
||||
PROP_MODIFIER_STATE,
|
||||
LAST_PROP
|
||||
GDK_DEVICE_PROP_0,
|
||||
GDK_DEVICE_PROP_DISPLAY,
|
||||
GDK_DEVICE_PROP_NAME,
|
||||
GDK_DEVICE_PROP_SOURCE,
|
||||
GDK_DEVICE_PROP_HAS_CURSOR,
|
||||
GDK_DEVICE_PROP_N_AXES,
|
||||
GDK_DEVICE_PROP_VENDOR_ID,
|
||||
GDK_DEVICE_PROP_PRODUCT_ID,
|
||||
GDK_DEVICE_PROP_SEAT,
|
||||
GDK_DEVICE_PROP_NUM_TOUCHES,
|
||||
GDK_DEVICE_PROP_TOOL,
|
||||
GDK_DEVICE_PROP_DIRECTION,
|
||||
GDK_DEVICE_PROP_HAS_BIDI_LAYOUTS,
|
||||
GDK_DEVICE_PROP_CAPS_LOCK_STATE,
|
||||
GDK_DEVICE_PROP_NUM_LOCK_STATE,
|
||||
GDK_DEVICE_PROP_SCROLL_LOCK_STATE,
|
||||
GDK_DEVICE_PROP_MODIFIER_STATE,
|
||||
GDK_DEVICE_LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *device_props[LAST_PROP] = { NULL, };
|
||||
static GParamSpec *gdk_device_properties[GDK_DEVICE_LAST_PROP] = { NULL, };
|
||||
|
||||
static void
|
||||
gdk_device_class_init (GdkDeviceClass *klass)
|
||||
@@ -104,32 +104,32 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
object_class->get_property = gdk_device_get_property;
|
||||
|
||||
/**
|
||||
* GdkDevice:display: (attributes org.gtk.Property.get=gdk_device_get_display)
|
||||
* GdkDevice:display:
|
||||
*
|
||||
* The `GdkDisplay` the `GdkDevice` pertains to.
|
||||
*/
|
||||
device_props[PROP_DISPLAY] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:name: (attributes org.gtk.Property.get=gdk_device_get_name)
|
||||
* GdkDevice:name:
|
||||
*
|
||||
* The device name.
|
||||
*/
|
||||
device_props[PROP_NAME] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_NAME] =
|
||||
g_param_spec_string ("name", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:source: (attributes org.gtk.Property.get=gdk_device_get_source)
|
||||
* GdkDevice:source:
|
||||
*
|
||||
* Source type for the device.
|
||||
*/
|
||||
device_props[PROP_SOURCE] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_SOURCE] =
|
||||
g_param_spec_enum ("source", NULL, NULL,
|
||||
GDK_TYPE_INPUT_SOURCE,
|
||||
GDK_SOURCE_MOUSE,
|
||||
@@ -137,11 +137,11 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDevice:has-cursor: (attributes org.gtk.Property.get=gdk_device_get_has_cursor)
|
||||
* GdkDevice:has-cursor:
|
||||
*
|
||||
* Whether the device is represented by a cursor on the screen.
|
||||
*/
|
||||
device_props[PROP_HAS_CURSOR] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_HAS_CURSOR] =
|
||||
g_param_spec_boolean ("has-cursor", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
@@ -152,58 +152,58 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
*
|
||||
* Number of axes in the device.
|
||||
*/
|
||||
device_props[PROP_N_AXES] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_N_AXES] =
|
||||
g_param_spec_uint ("n-axes", NULL, NULL,
|
||||
0, G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:vendor-id: (attributes org.gtk.Property.get=gdk_device_get_vendor_id)
|
||||
* GdkDevice:vendor-id:
|
||||
*
|
||||
* Vendor ID of this device.
|
||||
*
|
||||
* See [method@Gdk.Device.get_vendor_id].
|
||||
*/
|
||||
device_props[PROP_VENDOR_ID] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_VENDOR_ID] =
|
||||
g_param_spec_string ("vendor-id", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:product-id: (attributes org.gtk.Property.get=gdk_device_get_product_id)
|
||||
* GdkDevice:product-id:
|
||||
*
|
||||
* Product ID of this device.
|
||||
*
|
||||
* See [method@Gdk.Device.get_product_id].
|
||||
*/
|
||||
device_props[PROP_PRODUCT_ID] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_PRODUCT_ID] =
|
||||
g_param_spec_string ("product-id", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:seat: (attributes org.gtk.Property.get=gdk_device_get_seat)
|
||||
* GdkDevice:seat:
|
||||
*
|
||||
* `GdkSeat` of this device.
|
||||
*/
|
||||
device_props[PROP_SEAT] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_SEAT] =
|
||||
g_param_spec_object ("seat", NULL, NULL,
|
||||
GDK_TYPE_SEAT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:num-touches: (attributes org.gtk.Property.get=gdk_device_get_num_touches)
|
||||
* GdkDevice:num-touches:
|
||||
*
|
||||
* The maximal number of concurrent touches on a touch device.
|
||||
*
|
||||
* Will be 0 if the device is not a touch device or if the number
|
||||
* of touches is unknown.
|
||||
*/
|
||||
device_props[PROP_NUM_TOUCHES] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_NUM_TOUCHES] =
|
||||
g_param_spec_uint ("num-touches", NULL, NULL,
|
||||
0, G_MAXUINT,
|
||||
0,
|
||||
@@ -211,89 +211,89 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:tool: (attributes org.gtk.Property.get=gdk_device_get_device_tool)
|
||||
* GdkDevice:tool: (getter get_device_tool)
|
||||
*
|
||||
* The `GdkDeviceTool` that is currently used with this device.
|
||||
*/
|
||||
device_props[PROP_TOOL] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_TOOL] =
|
||||
g_param_spec_object ("tool", NULL, NULL,
|
||||
GDK_TYPE_DEVICE_TOOL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:direction: (attributes org.gtk.Property.get=gdk_device_get_direction)
|
||||
* GdkDevice:direction:
|
||||
*
|
||||
* The direction of the current layout.
|
||||
*
|
||||
* This is only relevant for keyboard devices.
|
||||
*/
|
||||
device_props[PROP_DIRECTION] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_DIRECTION] =
|
||||
g_param_spec_enum ("direction", NULL, NULL,
|
||||
PANGO_TYPE_DIRECTION, PANGO_DIRECTION_NEUTRAL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:has-bidi-layouts: (attributes org.gtk.Property.get=gdk_device_has_bidi_layouts)
|
||||
* GdkDevice:has-bidi-layouts:
|
||||
*
|
||||
* Whether the device has both right-to-left and left-to-right layouts.
|
||||
*
|
||||
* This is only relevant for keyboard devices.
|
||||
*/
|
||||
device_props[PROP_HAS_BIDI_LAYOUTS] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_HAS_BIDI_LAYOUTS] =
|
||||
g_param_spec_boolean ("has-bidi-layouts", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:caps-lock-state: (attributes org.gtk.Property.get=gdk_device_get_caps_lock_state)
|
||||
* GdkDevice:caps-lock-state:
|
||||
*
|
||||
* Whether Caps Lock is on.
|
||||
*
|
||||
* This is only relevant for keyboard devices.
|
||||
*/
|
||||
device_props[PROP_CAPS_LOCK_STATE] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_CAPS_LOCK_STATE] =
|
||||
g_param_spec_boolean ("caps-lock-state", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:num-lock-state: (attributes org.gtk.Property.get=gdk_device_get_num_lock_state)
|
||||
* GdkDevice:num-lock-state:
|
||||
*
|
||||
* Whether Num Lock is on.
|
||||
*
|
||||
* This is only relevant for keyboard devices.
|
||||
*/
|
||||
device_props[PROP_NUM_LOCK_STATE] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_NUM_LOCK_STATE] =
|
||||
g_param_spec_boolean ("num-lock-state", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:scroll-lock-state: (attributes org.gtk.Property.get=gdk_device_get_scroll_lock_state)
|
||||
* GdkDevice:scroll-lock-state:
|
||||
*
|
||||
* Whether Scroll Lock is on.
|
||||
*
|
||||
* This is only relevant for keyboard devices.
|
||||
*/
|
||||
device_props[PROP_SCROLL_LOCK_STATE] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_SCROLL_LOCK_STATE] =
|
||||
g_param_spec_boolean ("scroll-lock-state", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:modifier-state: (attributes org.gtk.Property.get=gdk_device_get_modifier_state)
|
||||
* GdkDevice:modifier-state:
|
||||
*
|
||||
* The current modifier state of the device.
|
||||
*
|
||||
* This is only relevant for keyboard devices.
|
||||
*/
|
||||
device_props[PROP_MODIFIER_STATE] =
|
||||
gdk_device_properties[GDK_DEVICE_PROP_MODIFIER_STATE] =
|
||||
g_param_spec_flags ("modifier-state", NULL, NULL,
|
||||
GDK_TYPE_MODIFIER_TYPE,
|
||||
GDK_NO_MODIFIER_MASK,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
||||
g_object_class_install_properties (object_class, GDK_DEVICE_LAST_PROP, gdk_device_properties);
|
||||
|
||||
/**
|
||||
* GdkDevice::changed:
|
||||
@@ -307,7 +307,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
* that case the logical device will change to reflect the axes
|
||||
* and keys on the new physical device.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
gdk_device_signals[GDK_DEVICE_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -322,7 +322,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
*
|
||||
* Emitted on pen/eraser devices whenever tools enter or leave proximity.
|
||||
*/
|
||||
signals[TOOL_CHANGED] =
|
||||
gdk_device_signals[GDK_DEVICE_TOOL_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("tool-changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -389,30 +389,30 @@ gdk_device_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DEVICE_PROP_DISPLAY:
|
||||
device->display = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_NAME:
|
||||
case GDK_DEVICE_PROP_NAME:
|
||||
g_free (device->name);
|
||||
|
||||
device->name = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_SOURCE:
|
||||
case GDK_DEVICE_PROP_SOURCE:
|
||||
device->source = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_HAS_CURSOR:
|
||||
case GDK_DEVICE_PROP_HAS_CURSOR:
|
||||
device->has_cursor = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_VENDOR_ID:
|
||||
case GDK_DEVICE_PROP_VENDOR_ID:
|
||||
device->vendor_id = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_PRODUCT_ID:
|
||||
case GDK_DEVICE_PROP_PRODUCT_ID:
|
||||
device->product_id = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_SEAT:
|
||||
case GDK_DEVICE_PROP_SEAT:
|
||||
device->seat = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_NUM_TOUCHES:
|
||||
case GDK_DEVICE_PROP_NUM_TOUCHES:
|
||||
device->num_touches = g_value_get_uint (value);
|
||||
break;
|
||||
default:
|
||||
@@ -431,52 +431,52 @@ gdk_device_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DEVICE_PROP_DISPLAY:
|
||||
g_value_set_object (value, device->display);
|
||||
break;
|
||||
case PROP_NAME:
|
||||
case GDK_DEVICE_PROP_NAME:
|
||||
g_value_set_string (value, device->name);
|
||||
break;
|
||||
case PROP_SOURCE:
|
||||
case GDK_DEVICE_PROP_SOURCE:
|
||||
g_value_set_enum (value, device->source);
|
||||
break;
|
||||
case PROP_HAS_CURSOR:
|
||||
case GDK_DEVICE_PROP_HAS_CURSOR:
|
||||
g_value_set_boolean (value, device->has_cursor);
|
||||
break;
|
||||
case PROP_N_AXES:
|
||||
case GDK_DEVICE_PROP_N_AXES:
|
||||
g_value_set_uint (value, device->axes->len);
|
||||
break;
|
||||
case PROP_VENDOR_ID:
|
||||
case GDK_DEVICE_PROP_VENDOR_ID:
|
||||
g_value_set_string (value, device->vendor_id);
|
||||
break;
|
||||
case PROP_PRODUCT_ID:
|
||||
case GDK_DEVICE_PROP_PRODUCT_ID:
|
||||
g_value_set_string (value, device->product_id);
|
||||
break;
|
||||
case PROP_SEAT:
|
||||
case GDK_DEVICE_PROP_SEAT:
|
||||
g_value_set_object (value, device->seat);
|
||||
break;
|
||||
case PROP_NUM_TOUCHES:
|
||||
case GDK_DEVICE_PROP_NUM_TOUCHES:
|
||||
g_value_set_uint (value, device->num_touches);
|
||||
break;
|
||||
case PROP_TOOL:
|
||||
case GDK_DEVICE_PROP_TOOL:
|
||||
g_value_set_object (value, device->last_tool);
|
||||
break;
|
||||
case PROP_DIRECTION:
|
||||
case GDK_DEVICE_PROP_DIRECTION:
|
||||
g_value_set_enum (value, gdk_device_get_direction (device));
|
||||
break;
|
||||
case PROP_HAS_BIDI_LAYOUTS:
|
||||
case GDK_DEVICE_PROP_HAS_BIDI_LAYOUTS:
|
||||
g_value_set_boolean (value, gdk_device_has_bidi_layouts (device));
|
||||
break;
|
||||
case PROP_CAPS_LOCK_STATE:
|
||||
case GDK_DEVICE_PROP_CAPS_LOCK_STATE:
|
||||
g_value_set_boolean (value, gdk_device_get_caps_lock_state (device));
|
||||
break;
|
||||
case PROP_NUM_LOCK_STATE:
|
||||
case GDK_DEVICE_PROP_NUM_LOCK_STATE:
|
||||
g_value_set_boolean (value, gdk_device_get_num_lock_state (device));
|
||||
break;
|
||||
case PROP_SCROLL_LOCK_STATE:
|
||||
case GDK_DEVICE_PROP_SCROLL_LOCK_STATE:
|
||||
g_value_set_boolean (value, gdk_device_get_scroll_lock_state (device));
|
||||
break;
|
||||
case PROP_MODIFIER_STATE:
|
||||
case GDK_DEVICE_PROP_MODIFIER_STATE:
|
||||
g_value_set_flags (value, gdk_device_get_modifier_state (device));
|
||||
break;
|
||||
default:
|
||||
@@ -540,7 +540,7 @@ gdk_device_get_name (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_has_cursor: (attributes org.gtk.Method.get_property=has-cursor)
|
||||
* gdk_device_get_has_cursor:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Determines whether the pointer follows device motion.
|
||||
@@ -559,7 +559,7 @@ gdk_device_get_has_cursor (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_source: (attributes org.gtk.Method.get_property=source)
|
||||
* gdk_device_get_source:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Determines the type of the device.
|
||||
@@ -599,7 +599,7 @@ gdk_device_get_axis_use (GdkDevice *device,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_device_get_display:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Returns the `GdkDisplay` to which @device pertains.
|
||||
@@ -806,7 +806,7 @@ _gdk_device_reset_axes (GdkDevice *device)
|
||||
for (i = device->axes->len - 1; i >= 0; i--)
|
||||
g_array_remove_index (device->axes, i);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_N_AXES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (device), gdk_device_properties[GDK_DEVICE_PROP_N_AXES]);
|
||||
}
|
||||
|
||||
guint
|
||||
@@ -845,7 +845,7 @@ _gdk_device_add_axis (GdkDevice *device,
|
||||
device->axes = g_array_append_val (device->axes, axis_info);
|
||||
pos = device->axes->len - 1;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_N_AXES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (device), gdk_device_properties[GDK_DEVICE_PROP_N_AXES]);
|
||||
|
||||
return pos;
|
||||
}
|
||||
@@ -1082,7 +1082,7 @@ _gdk_device_surface_at_position (GdkDevice *device,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_vendor_id: (attributes org.gtk.Method.get_property=vendor-id)
|
||||
* gdk_device_get_vendor_id:
|
||||
* @device: a physical `GdkDevice`
|
||||
*
|
||||
* Returns the vendor ID of this device.
|
||||
@@ -1124,7 +1124,7 @@ gdk_device_get_vendor_id (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_product_id: (attributes org.gtk.Method.get_property=product-id)
|
||||
* gdk_device_get_product_id:
|
||||
* @device: a physical `GdkDevice`
|
||||
*
|
||||
* Returns the product ID of this device.
|
||||
@@ -1157,7 +1157,7 @@ gdk_device_set_seat (GdkDevice *device,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_seat: (attributes org.gtk.Method.get_property=seat)
|
||||
* gdk_device_get_seat:
|
||||
* @device: A `GdkDevice`
|
||||
*
|
||||
* Returns the `GdkSeat` the device belongs to.
|
||||
@@ -1181,7 +1181,7 @@ gdk_device_update_tool (GdkDevice *device,
|
||||
if (g_set_object (&device->last_tool, tool))
|
||||
{
|
||||
g_object_notify (G_OBJECT (device), "tool");
|
||||
g_signal_emit (device, signals[TOOL_CHANGED], 0, tool);
|
||||
g_signal_emit (device, gdk_device_signals[GDK_DEVICE_TOOL_CHANGED], 0, tool);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1202,7 +1202,7 @@ gdk_device_get_num_touches (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_device_tool: (attributes org.gtk.Method.get_property=tool)
|
||||
* gdk_device_get_device_tool: (get-property tool)
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Retrieves the current tool for @device.
|
||||
@@ -1218,7 +1218,7 @@ gdk_device_get_device_tool (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_caps_lock_state: (attributes org.gtk.Method.get_property=caps-lock-state)
|
||||
* gdk_device_get_caps_lock_state:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Retrieves whether the Caps Lock modifier of the keyboard is locked.
|
||||
@@ -1239,7 +1239,7 @@ gdk_device_get_caps_lock_state (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_num_lock_state: (attributes org.gtk.Method.get_property=num-lock-state)
|
||||
* gdk_device_get_num_lock_state:
|
||||
* @device: a ``GdkDevice`
|
||||
*
|
||||
* Retrieves whether the Num Lock modifier of the keyboard is locked.
|
||||
@@ -1260,7 +1260,7 @@ gdk_device_get_num_lock_state (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_scroll_lock_state: (attributes org.gtk.Method.get_property=scroll-lock-state)
|
||||
* gdk_device_get_scroll_lock_state:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Retrieves whether the Scroll Lock modifier of the keyboard is locked.
|
||||
@@ -1281,7 +1281,7 @@ gdk_device_get_scroll_lock_state (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_modifier_state: (attributes org.gtk.Method.get_property=modifier-state)
|
||||
* gdk_device_get_modifier_state:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Retrieves the current modifier state of the keyboard.
|
||||
@@ -1302,7 +1302,7 @@ gdk_device_get_modifier_state (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_direction: (attributes org.gtk.Method.get_property=direction)
|
||||
* gdk_device_get_direction:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Returns the direction of effective layout of the keyboard.
|
||||
@@ -1328,7 +1328,7 @@ gdk_device_get_direction (GdkDevice *device)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_has_bidi_layouts: (attributes org.gtk.Method.get_property=has-bidi-layouts)
|
||||
* gdk_device_has_bidi_layouts:
|
||||
* @device: a `GdkDevice`
|
||||
*
|
||||
* Determines if layouts for both right-to-left and
|
||||
|
||||
+8
-8
@@ -107,7 +107,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
object_class->get_property = gdk_device_tool_get_property;
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:serial: (attributes org.gtk.Property.get=gdk_device_tool_get_serial)
|
||||
* GdkDeviceTool:serial:
|
||||
*
|
||||
* The serial number of the tool.
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:tool-type: (attributes org.gtk.Property.get=gdk_device_tool_get_tool_type)
|
||||
* GdkDeviceTool:tool-type:
|
||||
*
|
||||
* The type of the tool.
|
||||
*/
|
||||
@@ -130,7 +130,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:axes: (attributes org.gtk.Property.get=gdk_device_tool_get_axes)
|
||||
* GdkDeviceTool:axes:
|
||||
*
|
||||
* The axes of the tool.
|
||||
*/
|
||||
@@ -140,7 +140,7 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:hardware-id: (attributes org.gtk.Property.get=gdk_device_tool_get_hardware_id)
|
||||
* GdkDeviceTool:hardware-id:
|
||||
*
|
||||
* The hardware ID of the tool.
|
||||
*/
|
||||
@@ -173,7 +173,7 @@ gdk_device_tool_new (guint64 serial,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_serial: (attributes org.gtk.Method.get_property=serial)
|
||||
* gdk_device_tool_get_serial:
|
||||
* @tool: a `GdkDeviceTool`
|
||||
*
|
||||
* Gets the serial number of this tool.
|
||||
@@ -192,7 +192,7 @@ gdk_device_tool_get_serial (GdkDeviceTool *tool)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_hardware_id: (attributes org.gtk.Method.get_property=hardware-id)
|
||||
* gdk_device_tool_get_hardware_id:
|
||||
* @tool: a `GdkDeviceTool`
|
||||
*
|
||||
* Gets the hardware ID of this tool, or 0 if it's not known.
|
||||
@@ -218,7 +218,7 @@ gdk_device_tool_get_hardware_id (GdkDeviceTool *tool)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_tool_type: (attributes org.gtk.Method.get_property=tool-type)
|
||||
* gdk_device_tool_get_tool_type:
|
||||
* @tool: a `GdkDeviceTool`
|
||||
*
|
||||
* Gets the `GdkDeviceToolType` of the tool.
|
||||
@@ -236,7 +236,7 @@ gdk_device_tool_get_tool_type (GdkDeviceTool *tool)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_axes: (attributes org.gtk.Method.get_property=axes)
|
||||
* gdk_device_tool_get_axes:
|
||||
* @tool: a `GdkDeviceTool`
|
||||
*
|
||||
* Gets the axes of the tool.
|
||||
|
||||
+55
-55
@@ -74,24 +74,24 @@
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_COMPOSITED,
|
||||
PROP_RGBA,
|
||||
PROP_SHADOW_WIDTH,
|
||||
PROP_INPUT_SHAPES,
|
||||
PROP_DMABUF_FORMATS,
|
||||
LAST_PROP
|
||||
GDK_DISPLAY_PROP_0,
|
||||
GDK_DISPLAY_PROP_COMPOSITED,
|
||||
GDK_DISPLAY_PROP_RGBA,
|
||||
GDK_DISPLAY_PROP_SHADOW_WIDTH,
|
||||
GDK_DISPLAY_PROP_INPUT_SHAPES,
|
||||
GDK_DISPLAY_PROP_DMABUF_FORMATS,
|
||||
GDK_DISPLAY_LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *props[LAST_PROP] = { NULL, };
|
||||
static GParamSpec *gdk_display_properties[GDK_DISPLAY_LAST_PROP] = { NULL, };
|
||||
|
||||
enum {
|
||||
OPENED,
|
||||
CLOSED,
|
||||
SEAT_ADDED,
|
||||
SEAT_REMOVED,
|
||||
SETTING_CHANGED,
|
||||
LAST_SIGNAL
|
||||
GDK_DISPLAY_OPENED,
|
||||
GDK_DISPLAY_CLOSED,
|
||||
GDK_DISPLAY_SEAT_ADDED,
|
||||
GDK_DISPLAY_SEAT_REMOVED,
|
||||
GDK_DISPLAY_SETTING_CHANGED,
|
||||
GDK_DISPLAY_LAST_SIGNAL
|
||||
};
|
||||
|
||||
typedef struct _GdkDisplayPrivate GdkDisplayPrivate;
|
||||
@@ -124,7 +124,7 @@ static void gdk_display_finalize (GObject *object);
|
||||
|
||||
static GdkAppLaunchContext *gdk_display_real_get_app_launch_context (GdkDisplay *display);
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static guint gdk_display_signals[GDK_DISPLAY_LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GdkDisplay, gdk_display, G_TYPE_OBJECT)
|
||||
|
||||
@@ -138,23 +138,23 @@ gdk_display_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COMPOSITED:
|
||||
case GDK_DISPLAY_PROP_COMPOSITED:
|
||||
g_value_set_boolean (value, gdk_display_is_composited (display));
|
||||
break;
|
||||
|
||||
case PROP_RGBA:
|
||||
case GDK_DISPLAY_PROP_RGBA:
|
||||
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
||||
break;
|
||||
|
||||
case PROP_SHADOW_WIDTH:
|
||||
case GDK_DISPLAY_PROP_SHADOW_WIDTH:
|
||||
g_value_set_boolean (value, gdk_display_supports_shadow_width (display));
|
||||
break;
|
||||
|
||||
case PROP_INPUT_SHAPES:
|
||||
case GDK_DISPLAY_PROP_INPUT_SHAPES:
|
||||
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
||||
break;
|
||||
|
||||
case PROP_DMABUF_FORMATS:
|
||||
case GDK_DISPLAY_PROP_DMABUF_FORMATS:
|
||||
g_value_set_boxed (value, gdk_display_get_dmabuf_formats (display));
|
||||
break;
|
||||
|
||||
@@ -230,60 +230,60 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
class->opened = gdk_display_real_opened;
|
||||
|
||||
/**
|
||||
* GdkDisplay:composited: (attributes org.gtk.Property.get=gdk_display_is_composited)
|
||||
* GdkDisplay:composited: (getter is_composited)
|
||||
*
|
||||
* %TRUE if the display properly composites the alpha channel.
|
||||
*/
|
||||
props[PROP_COMPOSITED] =
|
||||
gdk_display_properties[GDK_DISPLAY_PROP_COMPOSITED] =
|
||||
g_param_spec_boolean ("composited", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:rgba: (attributes org.gtk.Property.get=gdk_display_is_rgba)
|
||||
* GdkDisplay:rgba: (getter is_rgba)
|
||||
*
|
||||
* %TRUE if the display supports an alpha channel.
|
||||
*/
|
||||
props[PROP_RGBA] =
|
||||
gdk_display_properties[GDK_DISPLAY_PROP_RGBA] =
|
||||
g_param_spec_boolean ("rgba", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:shadow-width: (attributes org.gtk.Property.get=gdk_display_supports_shadow_width)
|
||||
* GdkDisplay:shadow-width: (getter supports_shadow_width)
|
||||
*
|
||||
* %TRUE if the display supports extensible frames.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_SHADOW_WIDTH] =
|
||||
gdk_display_properties[GDK_DISPLAY_PROP_SHADOW_WIDTH] =
|
||||
g_param_spec_boolean ("shadow-width", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:input-shapes: (attributes org.gtk.Property.get=gdk_display_supports_input_shapes)
|
||||
* GdkDisplay:input-shapes: (getter supports_input_shapes)
|
||||
*
|
||||
* %TRUE if the display supports input shapes.
|
||||
*/
|
||||
props[PROP_INPUT_SHAPES] =
|
||||
gdk_display_properties[GDK_DISPLAY_PROP_INPUT_SHAPES] =
|
||||
g_param_spec_boolean ("input-shapes", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:dmabuf-formats: (attributes org.gtk.Property.get=gdk_display_get_dmabuf_formats)
|
||||
* GdkDisplay:dmabuf-formats:
|
||||
*
|
||||
* The dma-buf formats that are supported on this display
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_DMABUF_FORMATS] =
|
||||
gdk_display_properties[GDK_DISPLAY_PROP_DMABUF_FORMATS] =
|
||||
g_param_spec_boxed ("dmabuf-formats", NULL, NULL,
|
||||
GDK_TYPE_DMABUF_FORMATS,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
g_object_class_install_properties (object_class, GDK_DISPLAY_LAST_PROP, gdk_display_properties);
|
||||
|
||||
/**
|
||||
* GdkDisplay::opened:
|
||||
@@ -291,7 +291,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
*
|
||||
* Emitted when the connection to the windowing system for @display is opened.
|
||||
*/
|
||||
signals[OPENED] =
|
||||
gdk_display_signals[GDK_DISPLAY_OPENED] =
|
||||
g_signal_new (g_intern_static_string ("opened"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -307,7 +307,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
*
|
||||
* Emitted when the connection to the windowing system for @display is closed.
|
||||
*/
|
||||
signals[CLOSED] =
|
||||
gdk_display_signals[GDK_DISPLAY_CLOSED] =
|
||||
g_signal_new (g_intern_static_string ("closed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -325,7 +325,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
*
|
||||
* Emitted whenever a new seat is made known to the windowing system.
|
||||
*/
|
||||
signals[SEAT_ADDED] =
|
||||
gdk_display_signals[GDK_DISPLAY_SEAT_ADDED] =
|
||||
g_signal_new (g_intern_static_string ("seat-added"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -340,7 +340,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
*
|
||||
* Emitted whenever a seat is removed by the windowing system.
|
||||
*/
|
||||
signals[SEAT_REMOVED] =
|
||||
gdk_display_signals[GDK_DISPLAY_SEAT_REMOVED] =
|
||||
g_signal_new (g_intern_static_string ("seat-removed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -355,7 +355,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
*
|
||||
* Emitted whenever a setting changes its value.
|
||||
*/
|
||||
signals[SETTING_CHANGED] =
|
||||
gdk_display_signals[GDK_DISPLAY_SETTING_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("setting-changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -491,7 +491,7 @@ gdk_display_close (GdkDisplay *display)
|
||||
{
|
||||
display->closed = TRUE;
|
||||
|
||||
g_signal_emit (display, signals[CLOSED], 0, FALSE);
|
||||
g_signal_emit (display, gdk_display_signals[GDK_DISPLAY_CLOSED], 0, FALSE);
|
||||
g_object_run_dispose (G_OBJECT (display));
|
||||
|
||||
g_object_unref (display);
|
||||
@@ -1116,7 +1116,7 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_input_shapes: (attributes org.gtk.Method.get_property=input-shapes)
|
||||
* gdk_display_supports_input_shapes: (get-property input-shapes)
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Returns %TRUE if the display supports input shapes.
|
||||
@@ -1151,7 +1151,7 @@ gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
|
||||
priv->input_shapes = input_shapes;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_INPUT_SHAPES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (display), gdk_display_properties[GDK_DISPLAY_PROP_INPUT_SHAPES]);
|
||||
}
|
||||
|
||||
static GdkAppLaunchContext *
|
||||
@@ -1309,10 +1309,10 @@ gdk_display_create_vulkan_context (GdkDisplay *self,
|
||||
g_return_val_if_fail (surface == NULL || GDK_IS_SURFACE (surface), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_VULKAN_DISABLE)
|
||||
if (!gdk_has_feature (GDK_FEATURE_VULKAN))
|
||||
{
|
||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
_("Vulkan support disabled via GDK_DEBUG"));
|
||||
_("Vulkan support disabled via GDK_DISABLE"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1362,11 +1362,11 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
|
||||
before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_GL_DISABLE)
|
||||
if (!gdk_has_feature (GDK_FEATURE_OPENGL))
|
||||
{
|
||||
g_set_error_literal (&priv->gl_error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("GL support disabled via GDK_DEBUG"));
|
||||
_("OpenGL support disabled via GDK_DISABLE"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1477,7 +1477,7 @@ gdk_display_create_gl_context (GdkDisplay *self,
|
||||
if (!gdk_display_prepare_gl (self, error))
|
||||
return NULL;
|
||||
|
||||
return gdk_gl_context_new (self, NULL);
|
||||
return gdk_gl_context_new (self, NULL, FALSE);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
@@ -2006,7 +2006,7 @@ gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
builder = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
if (!GDK_DISPLAY_DEBUG_CHECK (self, DMABUF_DISABLE))
|
||||
if (gdk_has_feature (GDK_FEATURE_DMABUF))
|
||||
{
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_vulkan_get_dmabuf_downloader (self, builder));
|
||||
@@ -2075,7 +2075,7 @@ gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_is_composited: (attributes org.gtk.Method.get_property=composited)
|
||||
* gdk_display_is_composited: (get-property composited)
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Returns whether surfaces can reasonably be expected to have
|
||||
@@ -2116,11 +2116,11 @@ gdk_display_set_composited (GdkDisplay *display,
|
||||
|
||||
priv->composited = composited;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_COMPOSITED]);
|
||||
g_object_notify_by_pspec (G_OBJECT (display), gdk_display_properties[GDK_DISPLAY_PROP_COMPOSITED]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_is_rgba: (attributes org.gtk.Method.get_property=rgba)
|
||||
* gdk_display_is_rgba: (get-property rgba)
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Returns whether surfaces on this @display are created with an
|
||||
@@ -2161,11 +2161,11 @@ gdk_display_set_rgba (GdkDisplay *display,
|
||||
|
||||
priv->rgba = rgba;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_RGBA]);
|
||||
g_object_notify_by_pspec (G_OBJECT (display), gdk_display_properties[GDK_DISPLAY_PROP_RGBA]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_shadow_width: (attributes org.gtk.Method.get_property=shadow-width)
|
||||
* gdk_display_supports_shadow_width: (get-property shadow-width)
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Returns whether it's possible for a surface to draw outside of the window area.
|
||||
@@ -2201,7 +2201,7 @@ gdk_display_set_shadow_width (GdkDisplay *display,
|
||||
|
||||
priv->shadow_width = shadow_width;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_SHADOW_WIDTH]);
|
||||
g_object_notify_by_pspec (G_OBJECT (display), gdk_display_properties[GDK_DISPLAY_PROP_SHADOW_WIDTH]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2223,7 +2223,7 @@ gdk_display_add_seat (GdkDisplay *display,
|
||||
g_return_if_fail (GDK_IS_SEAT (seat));
|
||||
|
||||
display->seats = g_list_append (display->seats, g_object_ref (seat));
|
||||
g_signal_emit (display, signals[SEAT_ADDED], 0, seat);
|
||||
g_signal_emit (display, gdk_display_signals[GDK_DISPLAY_SEAT_ADDED], 0, seat);
|
||||
|
||||
g_signal_connect (seat, "device-removed", G_CALLBACK (device_removed_cb), display);
|
||||
}
|
||||
@@ -2244,7 +2244,7 @@ gdk_display_remove_seat (GdkDisplay *display,
|
||||
if (link)
|
||||
{
|
||||
display->seats = g_list_remove_link (display->seats, link);
|
||||
g_signal_emit (display, signals[SEAT_REMOVED], 0, seat);
|
||||
g_signal_emit (display, gdk_display_signals[GDK_DISPLAY_SEAT_REMOVED], 0, seat);
|
||||
g_object_unref (link->data);
|
||||
g_list_free (link);
|
||||
}
|
||||
@@ -2374,7 +2374,7 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
void
|
||||
gdk_display_emit_opened (GdkDisplay *display)
|
||||
{
|
||||
g_signal_emit (display, signals[OPENED], 0);
|
||||
g_signal_emit (display, gdk_display_signals[GDK_DISPLAY_OPENED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2405,7 +2405,7 @@ void
|
||||
gdk_display_setting_changed (GdkDisplay *display,
|
||||
const char *name)
|
||||
{
|
||||
g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
|
||||
g_signal_emit (display, gdk_display_signals[GDK_DISPLAY_SETTING_CHANGED], 0, name);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+12
-12
@@ -100,13 +100,13 @@
|
||||
*/
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DEFAULT_DISPLAY
|
||||
GDK_DISPLAY_MANAGER_PROP_0,
|
||||
GDK_DISPLAY_MANAGER_PROP_DEFAULT_DISPLAY
|
||||
};
|
||||
|
||||
enum {
|
||||
DISPLAY_OPENED,
|
||||
LAST_SIGNAL
|
||||
GDK_DISPLAY_MANAGER_DISPLAY_OPENED,
|
||||
GDK_DISPLAY_MANAGER_LAST_SIGNAL
|
||||
};
|
||||
|
||||
static void gdk_display_manager_set_property (GObject *object,
|
||||
@@ -118,7 +118,7 @@ static void gdk_display_manager_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static guint gdk_display_manager_signals[GDK_DISPLAY_MANAGER_LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT)
|
||||
|
||||
@@ -137,7 +137,7 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
|
||||
*
|
||||
* Emitted when a display is opened.
|
||||
*/
|
||||
signals[DISPLAY_OPENED] =
|
||||
gdk_display_manager_signals[GDK_DISPLAY_MANAGER_DISPLAY_OPENED] =
|
||||
g_signal_new (g_intern_static_string ("display-opened"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -149,12 +149,12 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
|
||||
GDK_TYPE_DISPLAY);
|
||||
|
||||
/**
|
||||
* GdkDisplayManager:default-display: (attributes org.gtk.Property.get=gdk_display_manager_get_default_display)
|
||||
* GdkDisplayManager:default-display:
|
||||
*
|
||||
* The default display.
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DEFAULT_DISPLAY,
|
||||
GDK_DISPLAY_MANAGER_PROP_DEFAULT_DISPLAY,
|
||||
g_param_spec_object ("default-display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
|
||||
@@ -173,7 +173,7 @@ gdk_display_manager_set_property (GObject *object,
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEFAULT_DISPLAY:
|
||||
case GDK_DISPLAY_MANAGER_PROP_DEFAULT_DISPLAY:
|
||||
gdk_display_manager_set_default_display (GDK_DISPLAY_MANAGER (object),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
@@ -191,7 +191,7 @@ gdk_display_manager_get_property (GObject *object,
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEFAULT_DISPLAY:
|
||||
case GDK_DISPLAY_MANAGER_PROP_DEFAULT_DISPLAY:
|
||||
g_value_set_object (value,
|
||||
gdk_display_manager_get_default_display (GDK_DISPLAY_MANAGER (object)));
|
||||
break;
|
||||
@@ -301,7 +301,7 @@ gdk_display_manager_get (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_manager_get_default_display: (attributes org.gtk.Method.get_property=default-display)
|
||||
* gdk_display_manager_get_default_display:
|
||||
* @manager: a `GdkDisplayManager`
|
||||
*
|
||||
* Gets the default `GdkDisplay`.
|
||||
@@ -455,7 +455,7 @@ _gdk_display_manager_add_display (GdkDisplayManager *manager,
|
||||
|
||||
manager->displays = g_slist_prepend (manager->displays, display);
|
||||
|
||||
g_signal_emit (manager, signals[DISPLAY_OPENED], 0, display);
|
||||
g_signal_emit (manager, gdk_display_manager_signals[GDK_DISPLAY_MANAGER_DISPLAY_OPENED], 0, display);
|
||||
}
|
||||
|
||||
/* NB: This function can be called multiple times per display. */
|
||||
|
||||
@@ -48,6 +48,7 @@ typedef enum {
|
||||
GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT = 1 << 2,
|
||||
GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT = 1 << 3,
|
||||
GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT = 1 << 4,
|
||||
GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE = 1 << 5,
|
||||
} GdkVulkanFeatures;
|
||||
|
||||
/* Tracks information about the device grab on this display */
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ download_memcpy (guchar *dst_data,
|
||||
bpp = gdk_memory_format_bytes_per_pixel (dst_format);
|
||||
src_stride = dmabuf->planes[0].stride;
|
||||
src_data = src_datas[0] + dmabuf->planes[0].offset;
|
||||
g_return_if_fail (sizes[0] >= dmabuf->planes[0].offset + gdk_memory_format_min_buffer_size (dst_format, dst_stride, width, height));
|
||||
g_return_if_fail (sizes[0] >= dmabuf->planes[0].offset + gdk_memory_format_min_buffer_size (dst_format, src_stride, width, height));
|
||||
|
||||
if (dst_stride == src_stride)
|
||||
memcpy (dst_data, src_data, (height - 1) * dst_stride + width * bpp);
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#ifndef DRM_FORMAT_MOD_INVALID
|
||||
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
|
||||
#endif
|
||||
|
||||
#ifndef fourcc_code
|
||||
#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
|
||||
((__u32)(c) << 16) | ((__u32)(d) << 24))
|
||||
|
||||
@@ -119,24 +119,24 @@ struct _GdkDmabufTextureBuilderClass
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_FOURCC,
|
||||
PROP_MODIFIER,
|
||||
PROP_PREMULTIPLIED,
|
||||
PROP_N_PLANES,
|
||||
PROP_COLOR_STATE,
|
||||
PROP_UPDATE_REGION,
|
||||
PROP_UPDATE_TEXTURE,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_0,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_DISPLAY,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_WIDTH,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_HEIGHT,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_FOURCC,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_MODIFIER,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_PREMULTIPLIED,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_N_PLANES,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_COLOR_STATE,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_REGION,
|
||||
GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE,
|
||||
|
||||
N_PROPS
|
||||
GDK_DMABUF_TEXTURE_BUILDER_N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkDmabufTextureBuilder, gdk_dmabuf_texture_builder, G_TYPE_OBJECT)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
static GParamSpec *gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gdk_dmabuf_texture_builder_dispose (GObject *object)
|
||||
@@ -160,43 +160,43 @@ gdk_dmabuf_texture_builder_get_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_DISPLAY:
|
||||
g_value_set_object (value, self->display);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_WIDTH:
|
||||
g_value_set_uint (value, self->width);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_HEIGHT:
|
||||
g_value_set_uint (value, self->height);
|
||||
break;
|
||||
|
||||
case PROP_FOURCC:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_FOURCC:
|
||||
g_value_set_uint (value, self->dmabuf.fourcc);
|
||||
break;
|
||||
|
||||
case PROP_MODIFIER:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_MODIFIER:
|
||||
g_value_set_uint64 (value, self->dmabuf.modifier);
|
||||
break;
|
||||
|
||||
case PROP_PREMULTIPLIED:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_PREMULTIPLIED:
|
||||
g_value_set_boolean (value, self->premultiplied);
|
||||
break;
|
||||
|
||||
case PROP_N_PLANES:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_N_PLANES:
|
||||
g_value_set_uint (value, self->dmabuf.n_planes);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_COLOR_STATE:
|
||||
g_value_set_boxed (value, self->color_state);
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_REGION:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_REGION:
|
||||
g_value_set_boxed (value, self->update_region);
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_TEXTURE:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE:
|
||||
g_value_set_object (value, self->update_texture);
|
||||
break;
|
||||
|
||||
@@ -216,43 +216,43 @@ gdk_dmabuf_texture_builder_set_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_DISPLAY:
|
||||
gdk_dmabuf_texture_builder_set_display (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_WIDTH:
|
||||
gdk_dmabuf_texture_builder_set_width (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_HEIGHT:
|
||||
gdk_dmabuf_texture_builder_set_height (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_FOURCC:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_FOURCC:
|
||||
gdk_dmabuf_texture_builder_set_fourcc (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_MODIFIER:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_MODIFIER:
|
||||
gdk_dmabuf_texture_builder_set_modifier (self, g_value_get_uint64 (value));
|
||||
break;
|
||||
|
||||
case PROP_PREMULTIPLIED:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_PREMULTIPLIED:
|
||||
gdk_dmabuf_texture_builder_set_premultiplied (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_N_PLANES:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_N_PLANES:
|
||||
gdk_dmabuf_texture_builder_set_n_planes (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_COLOR_STATE:
|
||||
gdk_dmabuf_texture_builder_set_color_state (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_REGION:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_REGION:
|
||||
gdk_dmabuf_texture_builder_set_update_region (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_TEXTURE:
|
||||
case GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE:
|
||||
gdk_dmabuf_texture_builder_set_update_texture (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
@@ -272,49 +272,49 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
gobject_class->set_property = gdk_dmabuf_texture_builder_set_property;
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:display: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_display org.gtk.Property.set=gdk_dmabuf_texture_builder_set_display)
|
||||
* GdkDmabufTextureBuilder:display:
|
||||
*
|
||||
* The display that this texture will be used on.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:width: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_width org.gtk.Property.set=gdk_dmabuf_texture_builder_set_width)
|
||||
* GdkDmabufTextureBuilder:width:
|
||||
*
|
||||
* The width of the texture.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_WIDTH] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_WIDTH] =
|
||||
g_param_spec_uint ("width", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:height: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_height org.gtk.Property.set=gdk_dmabuf_texture_builder_set_height)
|
||||
* GdkDmabufTextureBuilder:height:
|
||||
*
|
||||
* The height of the texture.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_HEIGHT] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_HEIGHT] =
|
||||
g_param_spec_uint ("height", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:fourcc: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_fourcc org.gtk.Property.set=gdk_dmabuf_texture_builder_set_fourcc)
|
||||
* GdkDmabufTextureBuilder:fourcc:
|
||||
*
|
||||
* The format of the texture, as a fourcc value.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_FOURCC] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_FOURCC] =
|
||||
g_param_spec_uint ("fourcc", NULL, NULL,
|
||||
0, 0xffffffff, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -326,7 +326,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_MODIFIER] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_MODIFIER] =
|
||||
g_param_spec_uint64 ("modifier", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -340,22 +340,22 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_PREMULTIPLIED] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_PREMULTIPLIED] =
|
||||
g_param_spec_boolean ("premultiplied", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:n-planes: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_n_planes org.gtk.Property.set=gdk_dmabuf_texture_builder_set_n_planes)
|
||||
* GdkDmabufTextureBuilder:n-planes:
|
||||
*
|
||||
* The number of planes of the texture.
|
||||
*
|
||||
* Note that you can set properties for other planes,
|
||||
* Note that you can set gdk_dmabuf_texture_builder_properties for other planes,
|
||||
* but they will be ignored when constructing the texture.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_N_PLANES] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_N_PLANES] =
|
||||
g_param_spec_uint ("n-planes", NULL, NULL,
|
||||
1, GDK_DMABUF_MAX_PLANES, 1,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -367,36 +367,36 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_STATE] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_COLOR_STATE] =
|
||||
g_param_spec_boxed ("color-state", NULL, NULL,
|
||||
GDK_TYPE_COLOR_STATE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-region: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_update_region org.gtk.Property.set=gdk_dmabuf_texture_builder_set_update_region)
|
||||
* GdkDmabufTextureBuilder:update-region:
|
||||
*
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_UPDATE_REGION] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_REGION] =
|
||||
g_param_spec_boxed ("update-region", NULL, NULL,
|
||||
CAIRO_GOBJECT_TYPE_REGION,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-texture: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_update_texture org.gtk.Property.set=gdk_dmabuf_texture_builder_set_update_texture)
|
||||
* GdkDmabufTextureBuilder:update-texture:
|
||||
*
|
||||
* The texture [property@Gdk.DmabufTextureBuilder:update-region] is an update for.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
properties[PROP_UPDATE_TEXTURE] =
|
||||
gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE] =
|
||||
g_param_spec_object ("update-texture", NULL, NULL,
|
||||
GDK_TYPE_TEXTURE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
g_object_class_install_properties (gobject_class, GDK_DMABUF_TEXTURE_BUILDER_N_PROPS, gdk_dmabuf_texture_builder_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -467,11 +467,11 @@ gdk_dmabuf_texture_builder_set_display (GdkDmabufTextureBuilder *self,
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
if (g_set_object (&self->display, display))
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DISPLAY]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_DISPLAY]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* gdk_dmabuf_texture_builder_get_width:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_dmabuf_texture_builder_set_width() or
|
||||
@@ -490,7 +490,7 @@ gdk_dmabuf_texture_builder_get_width (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* gdk_dmabuf_texture_builder_set_width:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -511,11 +511,11 @@ gdk_dmabuf_texture_builder_set_width (GdkDmabufTextureBuilder *self,
|
||||
|
||||
self->width = width;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_WIDTH]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_WIDTH]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* gdk_dmabuf_texture_builder_get_height:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_dmabuf_texture_builder_set_height() or
|
||||
@@ -534,7 +534,7 @@ gdk_dmabuf_texture_builder_get_height (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* gdk_dmabuf_texture_builder_set_height:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @height: the texture's height or 0 to unset
|
||||
*
|
||||
@@ -555,11 +555,11 @@ gdk_dmabuf_texture_builder_set_height (GdkDmabufTextureBuilder *self,
|
||||
|
||||
self->height = height;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HEIGHT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_HEIGHT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_fourcc: (attributes org.gtk.Method.get_property=fourcc)
|
||||
* gdk_dmabuf_texture_builder_get_fourcc:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_dmabuf_texture_builder_set_fourcc()
|
||||
@@ -580,7 +580,7 @@ gdk_dmabuf_texture_builder_get_fourcc (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_fourcc: (attributes org.gtk.Method.set_property=fourcc)
|
||||
* gdk_dmabuf_texture_builder_set_fourcc:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @fourcc: the texture's format or 0 to unset
|
||||
*
|
||||
@@ -603,7 +603,7 @@ gdk_dmabuf_texture_builder_set_fourcc (GdkDmabufTextureBuilder *self,
|
||||
|
||||
self->dmabuf.fourcc = fourcc;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FOURCC]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_FOURCC]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,11 +644,11 @@ gdk_dmabuf_texture_builder_set_modifier (GdkDmabufTextureBuilder *self,
|
||||
|
||||
self->dmabuf.modifier = modifier;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODIFIER]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_MODIFIER]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_n_planes: (attributes org.gtk.Method.get_property=n-planes)
|
||||
* gdk_dmabuf_texture_builder_get_n_planes:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the number of planes.
|
||||
@@ -706,11 +706,11 @@ gdk_dmabuf_texture_builder_set_premultiplied (GdkDmabufTextureBuilder *self,
|
||||
|
||||
self->premultiplied = premultiplied;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PREMULTIPLIED]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_PREMULTIPLIED]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_n_planes: (attributes org.gtk.Method.set_property=n-planes)
|
||||
* gdk_dmabuf_texture_builder_set_n_planes:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @n_planes: the number of planes
|
||||
*
|
||||
@@ -730,7 +730,7 @@ gdk_dmabuf_texture_builder_set_n_planes (GdkDmabufTextureBuilder *self,
|
||||
|
||||
self->dmabuf.n_planes = n_planes;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_PLANES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_N_PLANES]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -871,7 +871,7 @@ gdk_dmabuf_texture_builder_set_offset (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_color_state: (attributes org.gtk.Method.get_property=color-state)
|
||||
* gdk_dmabuf_texture_builder_get_color_state:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the color state previously set via gdk_dmabuf_texture_builder_set_color_state().
|
||||
@@ -889,7 +889,7 @@ gdk_dmabuf_texture_builder_get_color_state (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_color_state: (attributes org.gtk.Method.set_property=color-state)
|
||||
* gdk_dmabuf_texture_builder_set_color_state:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @color_state: (nullable): a `GdkColorState` or `NULL` to unset the colorstate.
|
||||
*
|
||||
@@ -916,11 +916,11 @@ gdk_dmabuf_texture_builder_set_color_state (GdkDmabufTextureBuilder *self,
|
||||
if (color_state)
|
||||
gdk_color_state_ref (color_state);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_COLOR_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_COLOR_STATE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* gdk_dmabuf_texture_builder_get_update_texture:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_dmabuf_texture_builder_set_update_texture() or
|
||||
@@ -939,7 +939,7 @@ gdk_dmabuf_texture_builder_get_update_texture (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* gdk_dmabuf_texture_builder_set_update_texture:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -958,11 +958,11 @@ gdk_dmabuf_texture_builder_set_update_texture (GdkDmabufTextureBuilder *self,
|
||||
if (!g_set_object (&self->update_texture, texture))
|
||||
return;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_TEXTURE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* gdk_dmabuf_texture_builder_get_update_region:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_dmabuf_texture_builder_set_update_region() or
|
||||
@@ -981,7 +981,7 @@ gdk_dmabuf_texture_builder_get_update_region (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* gdk_dmabuf_texture_builder_set_update_region:
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
@@ -1012,7 +1012,7 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
|
||||
if (region)
|
||||
self->update_region = cairo_region_reference (region);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_REGION]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_dmabuf_texture_builder_properties[GDK_DMABUF_TEXTURE_BUILDER_PROP_UPDATE_REGION]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1063,11 +1063,11 @@ gdk_dmabuf_texture_builder_build (GdkDmabufTextureBuilder *self,
|
||||
for (i = 0; i < self->dmabuf.n_planes; i++)
|
||||
g_return_val_if_fail (self->dmabuf.planes[i].fd != -1, NULL);
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self->display, DMABUF_DISABLE))
|
||||
if (!gdk_has_feature (GDK_FEATURE_DMABUF))
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
|
||||
"dmabuf support disabled via GDK_DEBUG environment variable");
|
||||
"dmabuf support disabled via GDK_DISABLE environment variable");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+58
-58
@@ -51,22 +51,22 @@
|
||||
#include "gdkeventsprivate.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CONTENT,
|
||||
PROP_DEVICE,
|
||||
PROP_DISPLAY,
|
||||
PROP_FORMATS,
|
||||
PROP_SELECTED_ACTION,
|
||||
PROP_ACTIONS,
|
||||
PROP_SURFACE,
|
||||
N_PROPERTIES
|
||||
GDK_DRAG_PROP_0,
|
||||
GDK_DRAG_PROP_CONTENT,
|
||||
GDK_DRAG_PROP_DEVICE,
|
||||
GDK_DRAG_PROP_DISPLAY,
|
||||
GDK_DRAG_PROP_FORMATS,
|
||||
GDK_DRAG_PROP_SELECTED_ACTION,
|
||||
GDK_DRAG_PROP_ACTIONS,
|
||||
GDK_DRAG_PROP_SURFACE,
|
||||
GDK_DRAG_N_PROPERTIES
|
||||
};
|
||||
|
||||
enum {
|
||||
CANCEL,
|
||||
DROP_PERFORMED,
|
||||
DND_FINISHED,
|
||||
N_SIGNALS
|
||||
GDK_DRAG_CANCEL,
|
||||
GDK_DRAG_DROP_PERFORMED,
|
||||
GDK_DRAG_DND_FINISHED,
|
||||
GDK_DRAG_N_SIGNALS
|
||||
};
|
||||
|
||||
typedef struct _GdkDragPrivate GdkDragPrivate;
|
||||
@@ -85,14 +85,14 @@ struct _GdkDragPrivate {
|
||||
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GParamSpec *gdk_drag_properties[GDK_DRAG_N_PROPERTIES] = { NULL, };
|
||||
static guint gdk_drag_signals[GDK_DRAG_N_SIGNALS] = { 0 };
|
||||
static GList *drags = NULL;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
* gdk_drag_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_drag_get_display:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Gets the `GdkDisplay` that the drag object was created for.
|
||||
@@ -110,7 +110,7 @@ gdk_drag_get_display (GdkDrag *drag)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_get_formats: (attributes org.gtk.Method.get_property=formats)
|
||||
* gdk_drag_get_formats:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Retrieves the formats supported by this `GdkDrag` object.
|
||||
@@ -128,7 +128,7 @@ gdk_drag_get_formats (GdkDrag *drag)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_get_actions: (attributes org.gtk.Method.get_property=actions)
|
||||
* gdk_drag_get_actions:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Determines the bitmask of possible actions proposed by the source.
|
||||
@@ -146,7 +146,7 @@ gdk_drag_get_actions (GdkDrag *drag)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_get_selected_action: (attributes org.gtk.Method.get_property=selected-action)
|
||||
* gdk_drag_get_selected_action:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Determines the action chosen by the drag destination.
|
||||
@@ -164,7 +164,7 @@ gdk_drag_get_selected_action (GdkDrag *drag)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_get_device: (attributes org.gtk.Method.get_property=device)
|
||||
* gdk_drag_get_device:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Returns the `GdkDevice` associated to the `GdkDrag` object.
|
||||
@@ -182,7 +182,7 @@ gdk_drag_get_device (GdkDrag *drag)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_get_content: (attributes org.gtk.Method.get_property=content)
|
||||
* gdk_drag_get_content:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Returns the `GdkContentProvider` associated to the `GdkDrag` object.
|
||||
@@ -200,7 +200,7 @@ gdk_drag_get_content (GdkDrag *drag)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_get_surface: (attributes org.gtk.Method.get_property=surface)
|
||||
* gdk_drag_get_surface:
|
||||
* @drag: a `GdkDrag`
|
||||
*
|
||||
* Returns the `GdkSurface` where the drag originates.
|
||||
@@ -234,7 +234,7 @@ gdk_drag_set_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
case GDK_DRAG_PROP_CONTENT:
|
||||
priv->content = g_value_dup_object (value);
|
||||
if (priv->content)
|
||||
{
|
||||
@@ -243,13 +243,13 @@ gdk_drag_set_property (GObject *gobject,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_DEVICE:
|
||||
case GDK_DRAG_PROP_DEVICE:
|
||||
priv->device = g_value_dup_object (value);
|
||||
g_assert (priv->device != NULL);
|
||||
priv->display = gdk_device_get_display (priv->device);
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
case GDK_DRAG_PROP_FORMATS:
|
||||
if (priv->formats)
|
||||
{
|
||||
GdkContentFormats *override = g_value_dup_boxed (value);
|
||||
@@ -266,21 +266,21 @@ gdk_drag_set_property (GObject *gobject,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SELECTED_ACTION:
|
||||
case GDK_DRAG_PROP_SELECTED_ACTION:
|
||||
{
|
||||
GdkDragAction action = g_value_get_flags (value);
|
||||
gdk_drag_set_selected_action (drag, action);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case PROP_ACTIONS:
|
||||
case GDK_DRAG_PROP_ACTIONS:
|
||||
{
|
||||
GdkDragAction actions = g_value_get_flags (value);
|
||||
gdk_drag_set_actions (drag, actions);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
case GDK_DRAG_PROP_SURFACE:
|
||||
priv->surface = g_value_dup_object (value);
|
||||
g_assert (priv->surface != NULL);
|
||||
break;
|
||||
@@ -302,31 +302,31 @@ gdk_drag_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
case GDK_DRAG_PROP_CONTENT:
|
||||
g_value_set_object (value, priv->content);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE:
|
||||
case GDK_DRAG_PROP_DEVICE:
|
||||
g_value_set_object (value, priv->device);
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DRAG_PROP_DISPLAY:
|
||||
g_value_set_object (value, priv->display);
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
case GDK_DRAG_PROP_FORMATS:
|
||||
g_value_set_boxed (value, priv->formats);
|
||||
break;
|
||||
|
||||
case PROP_SELECTED_ACTION:
|
||||
case GDK_DRAG_PROP_SELECTED_ACTION:
|
||||
g_value_set_flags (value, priv->selected_action);
|
||||
break;
|
||||
|
||||
case PROP_ACTIONS:
|
||||
case GDK_DRAG_PROP_ACTIONS:
|
||||
g_value_set_flags (value, priv->actions);
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
case GDK_DRAG_PROP_SURFACE:
|
||||
g_value_set_object (value, priv->surface);
|
||||
break;
|
||||
|
||||
@@ -362,11 +362,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
object_class->finalize = gdk_drag_finalize;
|
||||
|
||||
/**
|
||||
* GdkDrag:content: (attributes org.gtk.Property.get=gdk_drag_get_content)
|
||||
* GdkDrag:content:
|
||||
*
|
||||
* The `GdkContentProvider`.
|
||||
*/
|
||||
properties[PROP_CONTENT] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_CONTENT] =
|
||||
g_param_spec_object ("content", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_PROVIDER,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -375,11 +375,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrag:device: (attributes org.gtk.Property.get=gdk_drag_get_device)
|
||||
* GdkDrag:device:
|
||||
*
|
||||
* The `GdkDevice` that is performing the drag.
|
||||
*/
|
||||
properties[PROP_DEVICE] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_DEVICE] =
|
||||
g_param_spec_object ("device", NULL, NULL,
|
||||
GDK_TYPE_DEVICE,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -388,11 +388,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrag:display: (attributes org.gtk.Property.get=gdk_drag_get_display)
|
||||
* GdkDrag:display:
|
||||
*
|
||||
* The `GdkDisplay` that the drag belongs to.
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READABLE |
|
||||
@@ -400,11 +400,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrag:formats: (attributes org.gtk.Property.get=gdk_drag_get_formats)
|
||||
* GdkDrag:formats:
|
||||
*
|
||||
* The possible formats that the drag can provide its data in.
|
||||
*/
|
||||
properties[PROP_FORMATS] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_FORMATS] =
|
||||
g_param_spec_boxed ("formats", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_FORMATS,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -413,11 +413,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrag:selected-action: (attributes org.gtk.Property.get=gdk_drag_get_selected_action)
|
||||
* GdkDrag:selected-action:
|
||||
*
|
||||
* The currently selected action of the drag.
|
||||
*/
|
||||
properties[PROP_SELECTED_ACTION] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_SELECTED_ACTION] =
|
||||
g_param_spec_flags ("selected-action", NULL, NULL,
|
||||
GDK_TYPE_DRAG_ACTION,
|
||||
0,
|
||||
@@ -426,11 +426,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrag:actions: (attributes org.gtk.Property.get=gdk_drag_get_actions)
|
||||
* GdkDrag:actions:
|
||||
*
|
||||
* The possible actions of this drag.
|
||||
*/
|
||||
properties[PROP_ACTIONS] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_ACTIONS] =
|
||||
g_param_spec_flags ("actions", NULL, NULL,
|
||||
GDK_TYPE_DRAG_ACTION,
|
||||
0,
|
||||
@@ -439,11 +439,11 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrag:surface: (attributes org.gtk.Property.get=gdk_drag_get_surface)
|
||||
* GdkDrag:surface:
|
||||
*
|
||||
* The surface where the drag originates.
|
||||
*/
|
||||
properties[PROP_SURFACE] =
|
||||
gdk_drag_properties[GDK_DRAG_PROP_SURFACE] =
|
||||
g_param_spec_object ("surface", NULL, NULL,
|
||||
GDK_TYPE_SURFACE,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -458,7 +458,7 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
*
|
||||
* Emitted when the drag operation is cancelled.
|
||||
*/
|
||||
signals[CANCEL] =
|
||||
gdk_drag_signals[GDK_DRAG_CANCEL] =
|
||||
g_signal_new (g_intern_static_string ("cancel"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -473,7 +473,7 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
*
|
||||
* Emitted when the drop operation is performed on an accepting client.
|
||||
*/
|
||||
signals[DROP_PERFORMED] =
|
||||
gdk_drag_signals[GDK_DRAG_DROP_PERFORMED] =
|
||||
g_signal_new (g_intern_static_string ("drop-performed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -490,7 +490,7 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
*
|
||||
* The drag object can now free all miscellaneous data.
|
||||
*/
|
||||
signals[DND_FINISHED] =
|
||||
gdk_drag_signals[GDK_DRAG_DND_FINISHED] =
|
||||
g_signal_new (g_intern_static_string ("dnd-finished"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -499,7 +499,7 @@ gdk_drag_class_init (GdkDragClass *klass)
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
g_object_class_install_properties (object_class, GDK_DRAG_N_PROPERTIES, gdk_drag_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -633,7 +633,7 @@ gdk_drag_set_actions (GdkDrag *drag,
|
||||
|
||||
priv->actions = actions;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_ACTIONS]);
|
||||
g_object_notify_by_pspec (G_OBJECT (drag), gdk_drag_properties[GDK_DRAG_PROP_ACTIONS]);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -651,7 +651,7 @@ gdk_drag_set_selected_action (GdkDrag *drag,
|
||||
cursor = gdk_drag_get_cursor (drag, action);
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_SELECTED_ACTION]);
|
||||
g_object_notify_by_pspec (G_OBJECT (drag), gdk_drag_properties[GDK_DRAG_PROP_SELECTED_ACTION]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -751,7 +751,7 @@ gdk_drag_cancel (GdkDrag *drag,
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
g_signal_emit (drag, signals[CANCEL], 0, reason);
|
||||
g_signal_emit (drag, gdk_drag_signals[GDK_DRAG_CANCEL], 0, reason);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
+63
-31
@@ -53,15 +53,15 @@ struct _GdkDrawContextPrivate {
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
GDK_DRAW_CONTEXT_PROP_0,
|
||||
|
||||
PROP_DISPLAY,
|
||||
PROP_SURFACE,
|
||||
GDK_DRAW_CONTEXT_PROP_DISPLAY,
|
||||
GDK_DRAW_CONTEXT_PROP_SURFACE,
|
||||
|
||||
LAST_PROP
|
||||
GDK_DRAW_CONTEXT_LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *pspecs[LAST_PROP] = { NULL, };
|
||||
static GParamSpec *gdk_draw_context_properties[GDK_DRAW_CONTEXT_LAST_PROP] = { NULL, };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrawContext, gdk_draw_context, G_TYPE_OBJECT)
|
||||
|
||||
@@ -103,7 +103,7 @@ gdk_draw_context_set_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DRAW_CONTEXT_PROP_DISPLAY:
|
||||
if (priv->display != NULL)
|
||||
{
|
||||
g_assert (g_value_get_object (value) == NULL);
|
||||
@@ -114,7 +114,7 @@ gdk_draw_context_set_property (GObject *gobject,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
case GDK_DRAW_CONTEXT_PROP_SURFACE:
|
||||
priv->surface = g_value_dup_object (value);
|
||||
if (priv->surface)
|
||||
{
|
||||
@@ -146,11 +146,11 @@ gdk_draw_context_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DRAW_CONTEXT_PROP_DISPLAY:
|
||||
g_value_set_object (value, gdk_draw_context_get_display (context));
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
case GDK_DRAW_CONTEXT_PROP_SURFACE:
|
||||
g_value_set_object (value, priv->surface);
|
||||
break;
|
||||
|
||||
@@ -172,11 +172,11 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
|
||||
klass->empty_frame = gdk_draw_context_default_empty_frame;
|
||||
|
||||
/**
|
||||
* GdkDrawContext:display: (attributes org.gtk.Property.get=gdk_draw_context_get_display)
|
||||
* GdkDrawContext:display:
|
||||
*
|
||||
* The `GdkDisplay` used to create the `GdkDrawContext`.
|
||||
*/
|
||||
pspecs[PROP_DISPLAY] =
|
||||
gdk_draw_context_properties[GDK_DRAW_CONTEXT_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -184,18 +184,18 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDrawContext:surface: (attributes org.gtk.Property.get=gdk_draw_context_get_surface)
|
||||
* GdkDrawContext:surface:
|
||||
*
|
||||
* The `GdkSurface` the context is bound to.
|
||||
*/
|
||||
pspecs[PROP_SURFACE] =
|
||||
gdk_draw_context_properties[GDK_DRAW_CONTEXT_PROP_SURFACE] =
|
||||
g_param_spec_object ("surface", NULL, NULL,
|
||||
GDK_TYPE_SURFACE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, pspecs);
|
||||
g_object_class_install_properties (gobject_class, GDK_DRAW_CONTEXT_LAST_PROP, gdk_draw_context_properties);
|
||||
}
|
||||
|
||||
static guint pixels_counter;
|
||||
@@ -223,6 +223,9 @@ gdk_draw_context_init (GdkDrawContext *self)
|
||||
*
|
||||
* Returns: %TRUE if the context is between [method@Gdk.DrawContext.begin_frame]
|
||||
* and [method@Gdk.DrawContext.end_frame] calls.
|
||||
*
|
||||
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
|
||||
* Use `GskRenderNode` and `GskRenderer`.
|
||||
*/
|
||||
gboolean
|
||||
gdk_draw_context_is_in_frame (GdkDrawContext *context)
|
||||
@@ -248,7 +251,7 @@ gdk_draw_context_surface_resized (GdkDrawContext *context)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_context_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_draw_context_get_display:
|
||||
* @context: a `GdkDrawContext`
|
||||
*
|
||||
* Retrieves the `GdkDisplay` the @context is created for
|
||||
@@ -266,7 +269,7 @@ gdk_draw_context_get_display (GdkDrawContext *context)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_context_get_surface: (attributes org.gtk.Method.get_property=surface)
|
||||
* gdk_draw_context_get_surface:
|
||||
* @context: a `GdkDrawContext`
|
||||
*
|
||||
* Retrieves the surface that @context is bound to.
|
||||
@@ -313,6 +316,9 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
|
||||
* gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
|
||||
* use of [GskRenderer](../gsk4/class.Renderer.html)s, so application code
|
||||
* does not need to call these functions explicitly.
|
||||
*
|
||||
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
|
||||
* Use `GskRenderNode` and `GskRenderer`.
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
@@ -324,11 +330,12 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
g_return_if_fail (priv->surface != NULL);
|
||||
g_return_if_fail (region != NULL);
|
||||
|
||||
gdk_draw_context_begin_frame_full (context, GDK_MEMORY_U8, region);
|
||||
gdk_draw_context_begin_frame_full (context, GDK_MEMORY_U8, region, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* @depth: best depth to render in
|
||||
* @opaque: (nullable): opaque region of the rendering
|
||||
*
|
||||
* If the given depth is not `GDK_MEMORY_U8`, GDK will see about providing a
|
||||
* rendering target that supports a higher bit depth than 8 bits per channel.
|
||||
@@ -351,9 +358,10 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
* to choose.
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
GdkMemoryDepth depth,
|
||||
const cairo_region_t *region)
|
||||
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
GdkMemoryDepth depth,
|
||||
const cairo_region_t *region,
|
||||
const graphene_rect_t *opaque)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
@@ -378,19 +386,23 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_surface_set_opaque_rect (priv->surface, opaque);
|
||||
|
||||
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
|
||||
depth = GDK_MEMORY_FLOAT32;
|
||||
|
||||
priv->frame_region = cairo_region_copy (region);
|
||||
priv->surface->paint_context = g_object_ref (context);
|
||||
|
||||
g_assert (priv->color_state == NULL);
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context,
|
||||
depth,
|
||||
priv->frame_region,
|
||||
&priv->color_state,
|
||||
&priv->depth);
|
||||
|
||||
/* the callback is meant to set them */
|
||||
/* The callback is meant to set them. Note that it does not return a ref */
|
||||
g_assert (priv->color_state != NULL);
|
||||
g_assert (priv->depth < GDK_N_DEPTHS);
|
||||
|
||||
@@ -420,6 +432,21 @@ region_get_pixels (cairo_region_t *region)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
gdk_draw_context_end_frame_full (GdkDrawContext *context)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
|
||||
|
||||
gdk_profiler_set_int_counter (pixels_counter, region_get_pixels (priv->frame_region));
|
||||
|
||||
priv->color_state = NULL;
|
||||
g_clear_pointer (&priv->frame_region, cairo_region_destroy);
|
||||
g_clear_object (&priv->surface->paint_context);
|
||||
priv->depth = GDK_N_DEPTHS;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_context_end_frame:
|
||||
* @context: a `GdkDrawContext`
|
||||
@@ -432,6 +459,9 @@ region_get_pixels (cairo_region_t *region)
|
||||
* When using a [class@Gdk.GLContext], this function may call `glFlush()`
|
||||
* implicitly before returning; it is not recommended to call `glFlush()`
|
||||
* explicitly before calling this function.
|
||||
*
|
||||
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
|
||||
* Use `GskRenderNode` and `GskRenderer`.
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
@@ -459,14 +489,7 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
return;
|
||||
}
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
|
||||
|
||||
gdk_profiler_set_int_counter (pixels_counter, region_get_pixels (priv->frame_region));
|
||||
|
||||
g_clear_pointer (&priv->color_state, gdk_color_state_unref);
|
||||
g_clear_pointer (&priv->frame_region, cairo_region_destroy);
|
||||
g_clear_object (&priv->surface->paint_context);
|
||||
priv->depth = GDK_N_DEPTHS;
|
||||
gdk_draw_context_end_frame_full (context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -483,15 +506,24 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
* and [method@Gdk.DrawContext.end_frame], %NULL will be returned.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a Cairo region
|
||||
*
|
||||
* Deprecated: 4.16: Drawing directly to the surface is no longer recommended.
|
||||
* Use `GskRenderNode` and `GskRenderer`.
|
||||
*/
|
||||
const cairo_region_t *
|
||||
gdk_draw_context_get_frame_region (GdkDrawContext *context)
|
||||
_gdk_draw_context_get_frame_region (GdkDrawContext *context)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
return priv->frame_region;
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
(gdk_draw_context_get_frame_region) (GdkDrawContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
|
||||
|
||||
return priv->frame_region;
|
||||
return _gdk_draw_context_get_frame_region (context);
|
||||
}
|
||||
|
||||
/*<private>
|
||||
|
||||
@@ -40,15 +40,15 @@ GdkDisplay * gdk_draw_context_get_display (GdkDrawContext
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_draw_context_get_surface (GdkDrawContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
void gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
const cairo_region_t *region);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
void gdk_draw_context_end_frame (GdkDrawContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
gboolean gdk_draw_context_is_in_frame (GdkDrawContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
const cairo_region_t * gdk_draw_context_get_frame_region (GdkDrawContext *context);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "gdkcolorstateprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
|
||||
@@ -57,10 +59,14 @@ void gdk_draw_context_surface_resized (GdkDrawContext
|
||||
|
||||
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
GdkMemoryDepth depth,
|
||||
const cairo_region_t *region);
|
||||
const cairo_region_t *region,
|
||||
const graphene_rect_t *opaque);
|
||||
void gdk_draw_context_end_frame_full (GdkDrawContext *context);
|
||||
|
||||
void gdk_draw_context_empty_frame (GdkDrawContext *context);
|
||||
|
||||
#define gdk_draw_context_get_frame_region(...) _gdk_draw_context_get_frame_region(__VA_ARGS__)
|
||||
const cairo_region_t * _gdk_draw_context_get_frame_region (GdkDrawContext *self);
|
||||
GdkColorState * gdk_draw_context_get_color_state (GdkDrawContext *self);
|
||||
GdkMemoryDepth gdk_draw_context_get_depth (GdkDrawContext *self);
|
||||
|
||||
|
||||
+42
-42
@@ -71,17 +71,17 @@ struct _GdkDropPrivate {
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ACTIONS,
|
||||
PROP_DEVICE,
|
||||
PROP_DISPLAY,
|
||||
PROP_DRAG,
|
||||
PROP_FORMATS,
|
||||
PROP_SURFACE,
|
||||
N_PROPERTIES
|
||||
GDK_DROP_PROP_0,
|
||||
GDK_DROP_PROP_ACTIONS,
|
||||
GDK_DROP_PROP_DEVICE,
|
||||
GDK_DROP_PROP_DISPLAY,
|
||||
GDK_DROP_PROP_DRAG,
|
||||
GDK_DROP_PROP_FORMATS,
|
||||
GDK_DROP_PROP_SURFACE,
|
||||
GDK_DROP_N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static GParamSpec *gdk_drop_properties[GDK_DROP_N_PROPERTIES] = { NULL, };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrop, gdk_drop, G_TYPE_OBJECT)
|
||||
|
||||
@@ -210,29 +210,29 @@ gdk_drop_set_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIONS:
|
||||
case GDK_DROP_PROP_ACTIONS:
|
||||
gdk_drop_set_actions (self, g_value_get_flags (value));
|
||||
break;
|
||||
|
||||
case PROP_DEVICE:
|
||||
case GDK_DROP_PROP_DEVICE:
|
||||
priv->device = g_value_dup_object (value);
|
||||
g_assert (priv->device != NULL);
|
||||
if (priv->surface)
|
||||
g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
|
||||
break;
|
||||
|
||||
case PROP_DRAG:
|
||||
case GDK_DROP_PROP_DRAG:
|
||||
priv->drag = g_value_dup_object (value);
|
||||
if (priv->drag)
|
||||
gdk_drop_add_formats (self, gdk_drag_get_formats (priv->drag));
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
case GDK_DROP_PROP_FORMATS:
|
||||
gdk_drop_add_formats (self, g_value_get_boxed (value));
|
||||
g_assert (priv->formats != NULL);
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
case GDK_DROP_PROP_SURFACE:
|
||||
priv->surface = g_value_dup_object (value);
|
||||
g_assert (priv->surface != NULL);
|
||||
if (priv->device)
|
||||
@@ -256,27 +256,27 @@ gdk_drop_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIONS:
|
||||
case GDK_DROP_PROP_ACTIONS:
|
||||
g_value_set_flags (value, priv->actions);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE:
|
||||
case GDK_DROP_PROP_DEVICE:
|
||||
g_value_set_object (value, priv->device);
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
case GDK_DROP_PROP_DISPLAY:
|
||||
g_value_set_object (value, gdk_device_get_display (priv->device));
|
||||
break;
|
||||
|
||||
case PROP_DRAG:
|
||||
case GDK_DROP_PROP_DRAG:
|
||||
g_value_set_object (value, priv->drag);
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
case GDK_DROP_PROP_FORMATS:
|
||||
g_value_set_boxed (value, priv->formats);
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
case GDK_DROP_PROP_SURFACE:
|
||||
g_value_set_object (value, priv->surface);
|
||||
break;
|
||||
|
||||
@@ -320,11 +320,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
object_class->finalize = gdk_drop_finalize;
|
||||
|
||||
/**
|
||||
* GdkDrop:actions: (attributes org.gtk.Property.get=gdk_drop_get_actions)
|
||||
* GdkDrop:actions:
|
||||
*
|
||||
* The possible actions for this drop
|
||||
*/
|
||||
properties[PROP_ACTIONS] =
|
||||
gdk_drop_properties[GDK_DROP_PROP_ACTIONS] =
|
||||
g_param_spec_flags ("actions", NULL, NULL,
|
||||
GDK_TYPE_DRAG_ACTION,
|
||||
GDK_ACTION_ALL,
|
||||
@@ -334,11 +334,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrop:device: (attributes org.gtk.Property.get=gdk_drop_get_device)
|
||||
* GdkDrop:device:
|
||||
*
|
||||
* The `GdkDevice` performing the drop
|
||||
*/
|
||||
properties[PROP_DEVICE] =
|
||||
gdk_drop_properties[GDK_DROP_PROP_DEVICE] =
|
||||
g_param_spec_object ("device", NULL, NULL,
|
||||
GDK_TYPE_DEVICE,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -347,11 +347,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrop:display: (attributes org.gtk.Property.get=gdk_drop_get_display)
|
||||
* GdkDrop:display:
|
||||
*
|
||||
* The `GdkDisplay` that the drop belongs to.
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
gdk_drop_properties[GDK_DROP_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READABLE |
|
||||
@@ -359,11 +359,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrop:drag: (attributes org.gtk.Property.get=gdk_drop_get_drag)
|
||||
* GdkDrop:drag:
|
||||
*
|
||||
* The `GdkDrag` that initiated this drop
|
||||
*/
|
||||
properties[PROP_DRAG] =
|
||||
gdk_drop_properties[GDK_DROP_PROP_DRAG] =
|
||||
g_param_spec_object ("drag", NULL, NULL,
|
||||
GDK_TYPE_DRAG,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -372,11 +372,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrop:formats: (attributes org.gtk.Property.get=gdk_drop_get_formats)
|
||||
* GdkDrop:formats:
|
||||
*
|
||||
* The possible formats that the drop can provide its data in.
|
||||
*/
|
||||
properties[PROP_FORMATS] =
|
||||
gdk_drop_properties[GDK_DROP_PROP_FORMATS] =
|
||||
g_param_spec_boxed ("formats", NULL, NULL,
|
||||
GDK_TYPE_CONTENT_FORMATS,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -385,11 +385,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDrop:surface: (attributes org.gtk.Property.get=gdk_drop_get_surface)
|
||||
* GdkDrop:surface:
|
||||
*
|
||||
* The `GdkSurface` the drop happens on
|
||||
*/
|
||||
properties[PROP_SURFACE] =
|
||||
gdk_drop_properties[GDK_DROP_PROP_SURFACE] =
|
||||
g_param_spec_object ("surface", NULL, NULL,
|
||||
GDK_TYPE_SURFACE,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -397,7 +397,7 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
g_object_class_install_properties (object_class, GDK_DROP_N_PROPERTIES, gdk_drop_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -406,7 +406,7 @@ gdk_drop_init (GdkDrop *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_drop_get_display:
|
||||
* @self: a `GdkDrop`
|
||||
*
|
||||
* Gets the `GdkDisplay` that @self was created for.
|
||||
@@ -424,7 +424,7 @@ gdk_drop_get_display (GdkDrop *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_device: (attributes org.gtk.Method.get_property=device)
|
||||
* gdk_drop_get_device:
|
||||
* @self: a `GdkDrop`
|
||||
*
|
||||
* Returns the `GdkDevice` performing the drop.
|
||||
@@ -442,7 +442,7 @@ gdk_drop_get_device (GdkDrop *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_formats: (attributes org.gtk.Method.get_property=formats)
|
||||
* gdk_drop_get_formats:
|
||||
* @self: a `GdkDrop`
|
||||
*
|
||||
* Returns the `GdkContentFormats` that the drop offers the data
|
||||
@@ -461,7 +461,7 @@ gdk_drop_get_formats (GdkDrop *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_surface: (attributes org.gtk.Method.get_property=surface)
|
||||
* gdk_drop_get_surface:
|
||||
* @self: a `GdkDrop`
|
||||
*
|
||||
* Returns the `GdkSurface` performing the drop.
|
||||
@@ -479,7 +479,7 @@ gdk_drop_get_surface (GdkDrop *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_actions: (attributes org.gtk.Method.get_property=actions)
|
||||
* gdk_drop_get_actions:
|
||||
* @self: a `GdkDrop`
|
||||
*
|
||||
* Returns the possible actions for this `GdkDrop`.
|
||||
@@ -524,11 +524,11 @@ gdk_drop_set_actions (GdkDrop *self,
|
||||
|
||||
priv->actions = actions;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIONS]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_drop_properties[GDK_DROP_PROP_ACTIONS]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_drag: (attributes org.gtk.Method.get_property=drag)
|
||||
* gdk_drop_get_drag:
|
||||
* @self: a `GdkDrop`
|
||||
*
|
||||
* If this is an in-app drag-and-drop operation, returns the `GdkDrag`
|
||||
@@ -764,7 +764,7 @@ gdk_drop_read_value_got_stream (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
free_value (gpointer value)
|
||||
gdk_drop_free_value (gpointer value)
|
||||
{
|
||||
g_value_unset (value);
|
||||
g_free (value);
|
||||
@@ -792,7 +792,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
g_task_set_source_tag (task, source_tag);
|
||||
value = g_new0 (GValue, 1);
|
||||
g_value_init (value, type);
|
||||
g_task_set_task_data (task, value, free_value);
|
||||
g_task_set_task_data (task, value, gdk_drop_free_value);
|
||||
|
||||
if (priv->drag)
|
||||
{
|
||||
|
||||
+12
-1
@@ -978,9 +978,13 @@ gdk_event_get_axis (GdkEvent *event,
|
||||
* according to platform conventions.
|
||||
*
|
||||
* The right mouse button typically triggers context menus.
|
||||
* On macOS, Control+left mouse button also triggers.
|
||||
*
|
||||
* This function should always be used instead of simply checking for
|
||||
* event->button == %GDK_BUTTON_SECONDARY.
|
||||
*
|
||||
* ```c
|
||||
* event->button == GDK_BUTTON_SECONDARY
|
||||
* ```
|
||||
*
|
||||
* Returns: %TRUE if the event should trigger a context menu.
|
||||
*/
|
||||
@@ -998,6 +1002,13 @@ gdk_event_triggers_context_menu (GdkEvent *event)
|
||||
if (bevent->button == GDK_BUTTON_SECONDARY &&
|
||||
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
|
||||
return TRUE;
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (bevent->button == GDK_BUTTON_PRIMARY &&
|
||||
(bevent->state & GDK_CONTROL_MASK) &&
|
||||
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
+23
-23
@@ -65,17 +65,17 @@
|
||||
*/
|
||||
|
||||
enum {
|
||||
FLUSH_EVENTS,
|
||||
BEFORE_PAINT,
|
||||
UPDATE,
|
||||
LAYOUT,
|
||||
PAINT,
|
||||
AFTER_PAINT,
|
||||
RESUME_EVENTS,
|
||||
LAST_SIGNAL
|
||||
GDK_FRAME_CLOCK_FLUSH_EVENTS,
|
||||
GDK_FRAME_CLOCK_BEFORE_PAINT,
|
||||
GDK_FRAME_CLOCK_UPDATE,
|
||||
GDK_FRAME_CLOCK_LAYOUT,
|
||||
GDK_FRAME_CLOCK_PAINT,
|
||||
GDK_FRAME_CLOCK_AFTER_PAINT,
|
||||
GDK_FRAME_CLOCK_RESUME_EVENTS,
|
||||
GDK_FRAME_CLOCK_LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL];
|
||||
static guint gdk_frame_clock_signals[GDK_FRAME_CLOCK_LAST_SIGNAL];
|
||||
|
||||
static guint fps_counter;
|
||||
|
||||
@@ -139,7 +139,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
*
|
||||
* Applications should not handle this signal.
|
||||
*/
|
||||
signals[FLUSH_EVENTS] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_FLUSH_EVENTS] =
|
||||
g_signal_new (g_intern_static_string ("flush-events"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -155,7 +155,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
*
|
||||
* Applications should generally not handle this signal.
|
||||
*/
|
||||
signals[BEFORE_PAINT] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_BEFORE_PAINT] =
|
||||
g_signal_new (g_intern_static_string ("before-paint"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -175,7 +175,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* [gtk_widget_add_tick_callback()](../gtk4/method.Widget.add_tick_callback.html)
|
||||
* as a more convenient interface.
|
||||
*/
|
||||
signals[UPDATE] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_UPDATE] =
|
||||
g_signal_new (g_intern_static_string ("update"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -193,7 +193,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* Any work to update sizes and positions of application elements
|
||||
* should be performed. GTK normally handles this internally.
|
||||
*/
|
||||
signals[LAYOUT] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_LAYOUT] =
|
||||
g_signal_new (g_intern_static_string ("layout"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -213,7 +213,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* [GtkWidget::snapshot](../gtk4/signal.Widget.snapshot.html) signals
|
||||
* by GTK.
|
||||
*/
|
||||
signals[PAINT] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_PAINT] =
|
||||
g_signal_new (g_intern_static_string ("paint"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -229,7 +229,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
*
|
||||
* Applications should generally not handle this signal.
|
||||
*/
|
||||
signals[AFTER_PAINT] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_AFTER_PAINT] =
|
||||
g_signal_new (g_intern_static_string ("after-paint"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -246,7 +246,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* This signal is handled internally by GTK to resume normal
|
||||
* event processing. Applications should not handle this signal.
|
||||
*/
|
||||
signals[RESUME_EVENTS] =
|
||||
gdk_frame_clock_signals[GDK_FRAME_CLOCK_RESUME_EVENTS] =
|
||||
g_signal_new (g_intern_static_string ("resume-events"),
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -693,13 +693,13 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
|
||||
void
|
||||
_gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock)
|
||||
{
|
||||
g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_FLUSH_EVENTS], 0);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock)
|
||||
{
|
||||
g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_BEFORE_PAINT], 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -709,7 +709,7 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
|
||||
|
||||
before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
g_signal_emit (frame_clock, signals[UPDATE], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_UPDATE], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock update", NULL);
|
||||
}
|
||||
@@ -721,7 +721,7 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
|
||||
|
||||
before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
g_signal_emit (frame_clock, signals[LAYOUT], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_LAYOUT], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock layout", NULL);
|
||||
}
|
||||
@@ -733,7 +733,7 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
|
||||
|
||||
before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
g_signal_emit (frame_clock, signals[PAINT], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_PAINT], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock paint", NULL);
|
||||
}
|
||||
@@ -741,13 +741,13 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
|
||||
void
|
||||
_gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock)
|
||||
{
|
||||
g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_AFTER_PAINT], 0);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
|
||||
{
|
||||
g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
|
||||
g_signal_emit (frame_clock, gdk_frame_clock_signals[GDK_FRAME_CLOCK_RESUME_EVENTS], 0);
|
||||
}
|
||||
|
||||
static gint64
|
||||
|
||||
+73
-73
@@ -35,13 +35,13 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define FRAME_INTERVAL 16667 /* microseconds */
|
||||
#define GDK_FRAME_CLOCK_IDLE_FRAME_INTERVAL 16667 /* microseconds */
|
||||
|
||||
typedef enum {
|
||||
SMOOTH_PHASE_STATE_VALID = 0, /* explicit, since we count on zero-init */
|
||||
SMOOTH_PHASE_STATE_AWAIT_FIRST,
|
||||
SMOOTH_PHASE_STATE_AWAIT_DRAWN,
|
||||
} SmoothDeltaState;
|
||||
GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_VALID = 0, /* explicit, since we count on zero-init */
|
||||
GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_AWAIT_FIRST,
|
||||
GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_AWAIT_DRAWN,
|
||||
} GdkFrameClockIdleSmoothDeltaState;
|
||||
|
||||
struct _GdkFrameClockIdlePrivate
|
||||
{
|
||||
@@ -51,9 +51,9 @@ struct _GdkFrameClockIdlePrivate
|
||||
gint64 smoothed_frame_time_reported; /* Ensures we are always monotonic */
|
||||
gint64 smoothed_frame_time_phase; /* The offset of the first reported frame time, in the current animation sequence, from the preceding vsync */
|
||||
gint64 min_next_frame_time; /* We're not synced to vblank, so wait at least until this before next cycle to avoid busy looping */
|
||||
SmoothDeltaState smooth_phase_state; /* The state of smoothed_frame_time_phase - is it valid, awaiting vsync etc. Thanks to zero-init, the initial value
|
||||
GdkFrameClockIdleSmoothDeltaState smooth_phase_state; /* The state of smoothed_frame_time_phase - is it valid, awaiting vsync etc. Thanks to zero-init, the initial value
|
||||
of smoothed_frame_time_phase is `0`. This is valid, since we didn't get a "frame drawn" event yet. Accordingly,
|
||||
the initial value of smooth_phase_state is SMOOTH_PHASE_STATE_VALID. See the comment in gdk_frame_clock_paint_idle()
|
||||
the initial value of smooth_phase_state is GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_VALID. See the comment in gdk_frame_clock_paint_idle()
|
||||
for details. */
|
||||
|
||||
gint64 sleep_serial;
|
||||
@@ -79,57 +79,57 @@ static gboolean gdk_frame_clock_paint_idle (void *data);
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GdkFrameClockIdle, gdk_frame_clock_idle, GDK_TYPE_FRAME_CLOCK)
|
||||
|
||||
static gint64 sleep_serial;
|
||||
static gint64 sleep_source_prepare_time;
|
||||
static GSource *sleep_source;
|
||||
static gint64 gdk_frame_clock_idle_sleep_serial;
|
||||
static gint64 gdk_frame_clock_idle_sleep_source_prepare_time;
|
||||
static GSource *gdk_frame_clock_idle_sleep_source;
|
||||
|
||||
static gboolean
|
||||
sleep_source_prepare (GSource *source,
|
||||
gdk_frame_clock_idle_sleep_source_prepare (GSource *source,
|
||||
int *timeout)
|
||||
{
|
||||
sleep_source_prepare_time = g_source_get_time (source);
|
||||
gdk_frame_clock_idle_sleep_source_prepare_time = g_source_get_time (source);
|
||||
*timeout = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sleep_source_check (GSource *source)
|
||||
gdk_frame_clock_idle_sleep_source_check (GSource *source)
|
||||
{
|
||||
if (g_source_get_time (source) != sleep_source_prepare_time)
|
||||
sleep_serial++;
|
||||
if (g_source_get_time (source) != gdk_frame_clock_idle_sleep_source_prepare_time)
|
||||
gdk_frame_clock_idle_sleep_serial++;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sleep_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
gdk_frame_clock_idle_sleep_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GSourceFuncs sleep_source_funcs = {
|
||||
sleep_source_prepare,
|
||||
sleep_source_check,
|
||||
sleep_source_dispatch,
|
||||
NULL /* finalize */
|
||||
};
|
||||
|
||||
static gint64
|
||||
get_sleep_serial (void)
|
||||
gdk_frame_clock_idle_get_sleep_serial (void)
|
||||
{
|
||||
if (sleep_source == NULL)
|
||||
{
|
||||
sleep_source = g_source_new (&sleep_source_funcs, sizeof (GSource));
|
||||
static GSourceFuncs sleep_source_funcs = {
|
||||
gdk_frame_clock_idle_sleep_source_prepare,
|
||||
gdk_frame_clock_idle_sleep_source_check,
|
||||
gdk_frame_clock_idle_sleep_source_dispatch,
|
||||
NULL /* finalize */
|
||||
};
|
||||
|
||||
g_source_set_static_name (sleep_source, "[gtk] sleep serial");
|
||||
g_source_set_priority (sleep_source, G_PRIORITY_HIGH);
|
||||
g_source_attach (sleep_source, NULL);
|
||||
g_source_unref (sleep_source);
|
||||
if (gdk_frame_clock_idle_sleep_source == NULL)
|
||||
{
|
||||
gdk_frame_clock_idle_sleep_source = g_source_new (&sleep_source_funcs, sizeof (GSource));
|
||||
|
||||
g_source_set_static_name (gdk_frame_clock_idle_sleep_source, "[gtk] sleep serial");
|
||||
g_source_set_priority (gdk_frame_clock_idle_sleep_source, G_PRIORITY_HIGH);
|
||||
g_source_attach (gdk_frame_clock_idle_sleep_source, NULL);
|
||||
g_source_unref (gdk_frame_clock_idle_sleep_source);
|
||||
}
|
||||
|
||||
return sleep_serial;
|
||||
return gdk_frame_clock_idle_sleep_serial;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -141,7 +141,7 @@ gdk_frame_clock_idle_init (GdkFrameClockIdle *frame_clock_idle)
|
||||
gdk_frame_clock_idle_get_instance_private (frame_clock_idle);
|
||||
|
||||
priv->freeze_count = 0;
|
||||
priv->smoothed_frame_time_period = FRAME_INTERVAL;
|
||||
priv->smoothed_frame_time_period = GDK_FRAME_CLOCK_IDLE_FRAME_INTERVAL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -175,11 +175,11 @@ gdk_frame_clock_idle_dispose (GObject *object)
|
||||
/* Note: This is never called on first frame, so
|
||||
* smoothed_frame_time_base != 0 and we have a valid frame_interval. */
|
||||
static gint64
|
||||
compute_smooth_frame_time (GdkFrameClock *clock,
|
||||
gint64 new_frame_time,
|
||||
gboolean new_frame_time_is_vsync_related,
|
||||
gint64 smoothed_frame_time_base,
|
||||
gint64 frame_interval)
|
||||
gdk_frame_clock_idle_compute_smooth_frame_time (GdkFrameClock *clock,
|
||||
gint64 new_frame_time,
|
||||
gboolean new_frame_time_is_vsync_related,
|
||||
gint64 smoothed_frame_time_base,
|
||||
gint64 frame_interval)
|
||||
{
|
||||
GdkFrameClockIdlePrivate *priv = GDK_FRAME_CLOCK_IDLE (clock)->priv;
|
||||
int frames_passed;
|
||||
@@ -267,9 +267,9 @@ gdk_frame_clock_idle_get_frame_time (GdkFrameClock *clock)
|
||||
|
||||
/* Since time is monotonic this is <= what we will pick for the next cycle, but
|
||||
more likely than not it will be equal if we're doing a constant animation. */
|
||||
new_smoothed_time = compute_smooth_frame_time (clock, now, FALSE,
|
||||
priv->smoothed_frame_time_base,
|
||||
priv->smoothed_frame_time_period);
|
||||
new_smoothed_time = gdk_frame_clock_idle_compute_smooth_frame_time (clock, now, FALSE,
|
||||
priv->smoothed_frame_time_base,
|
||||
priv->smoothed_frame_time_period);
|
||||
|
||||
priv->smoothed_frame_time_reported = new_smoothed_time;
|
||||
return new_smoothed_time;
|
||||
@@ -287,7 +287,7 @@ gdk_frame_clock_idle_is_frozen (GdkFrameClockIdle *self)
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
should_run_flush_idle (GdkFrameClockIdle *self)
|
||||
gdk_frame_clock_idle_should_run_flush_idle (GdkFrameClockIdle *self)
|
||||
{
|
||||
GdkFrameClockIdlePrivate *priv = self->priv;
|
||||
|
||||
@@ -301,7 +301,7 @@ should_run_flush_idle (GdkFrameClockIdle *self)
|
||||
* is cancelled.
|
||||
*/
|
||||
static inline gboolean
|
||||
should_run_paint_idle (GdkFrameClockIdle *self)
|
||||
gdk_frame_clock_idle_should_run_paint_idle (GdkFrameClockIdle *self)
|
||||
{
|
||||
GdkFrameClockIdlePrivate *priv = self->priv;
|
||||
|
||||
@@ -311,12 +311,12 @@ should_run_paint_idle (GdkFrameClockIdle *self)
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_start_idle (GdkFrameClockIdle *self,
|
||||
gboolean caused_by_thaw)
|
||||
gdk_frame_clock_idle_maybe_start_idle (GdkFrameClockIdle *self,
|
||||
gboolean caused_by_thaw)
|
||||
{
|
||||
GdkFrameClockIdlePrivate *priv = self->priv;
|
||||
|
||||
if (should_run_flush_idle (self) || should_run_paint_idle (self))
|
||||
if (gdk_frame_clock_idle_should_run_flush_idle (self) || gdk_frame_clock_idle_should_run_paint_idle (self))
|
||||
{
|
||||
guint min_interval = 0;
|
||||
|
||||
@@ -328,7 +328,7 @@ maybe_start_idle (GdkFrameClockIdle *self,
|
||||
min_interval = (min_interval_us + 500) / 1000;
|
||||
}
|
||||
|
||||
if (priv->flush_idle_id == 0 && should_run_flush_idle (self))
|
||||
if (priv->flush_idle_id == 0 && gdk_frame_clock_idle_should_run_flush_idle (self))
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
@@ -342,7 +342,7 @@ maybe_start_idle (GdkFrameClockIdle *self,
|
||||
}
|
||||
|
||||
if (!priv->in_paint_idle &&
|
||||
priv->paint_idle_id == 0 && should_run_paint_idle (self))
|
||||
priv->paint_idle_id == 0 && gdk_frame_clock_idle_should_run_paint_idle (self))
|
||||
{
|
||||
priv->paint_is_thaw = caused_by_thaw;
|
||||
priv->paint_idle_id = g_timeout_add_full (GDK_PRIORITY_REDRAW,
|
||||
@@ -356,17 +356,17 @@ maybe_start_idle (GdkFrameClockIdle *self,
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_stop_idle (GdkFrameClockIdle *self)
|
||||
gdk_frame_clock_idle_maybe_stop_idle (GdkFrameClockIdle *self)
|
||||
{
|
||||
GdkFrameClockIdlePrivate *priv = self->priv;
|
||||
|
||||
if (priv->flush_idle_id != 0 && !should_run_flush_idle (self))
|
||||
if (priv->flush_idle_id != 0 && !gdk_frame_clock_idle_should_run_flush_idle (self))
|
||||
{
|
||||
g_source_remove (priv->flush_idle_id);
|
||||
priv->flush_idle_id = 0;
|
||||
}
|
||||
|
||||
if (priv->paint_idle_id != 0 && !should_run_paint_idle (self))
|
||||
if (priv->paint_idle_id != 0 && !gdk_frame_clock_idle_should_run_paint_idle (self))
|
||||
{
|
||||
g_source_remove (priv->paint_idle_id);
|
||||
priv->paint_idle_id = 0;
|
||||
@@ -456,7 +456,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
case GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT:
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
{
|
||||
gint64 frame_interval = FRAME_INTERVAL;
|
||||
gint64 frame_interval = GDK_FRAME_CLOCK_IDLE_FRAME_INTERVAL;
|
||||
GdkFrameTimings *prev_timings = gdk_frame_clock_get_current_timings (clock);
|
||||
|
||||
if (prev_timings && prev_timings->refresh_interval)
|
||||
@@ -512,14 +512,14 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
* adjusted times | * | * | + | + | + |...
|
||||
* phase ^------^
|
||||
*/
|
||||
if (priv->smooth_phase_state == SMOOTH_PHASE_STATE_AWAIT_FIRST)
|
||||
if (priv->smooth_phase_state == GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_AWAIT_FIRST)
|
||||
{
|
||||
/* First animation cycle - usually unrelated to vsync */
|
||||
priv->smoothed_frame_time_base = 0;
|
||||
priv->smoothed_frame_time_phase = 0;
|
||||
priv->smooth_phase_state = SMOOTH_PHASE_STATE_AWAIT_DRAWN;
|
||||
priv->smooth_phase_state = GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_AWAIT_DRAWN;
|
||||
}
|
||||
else if (priv->smooth_phase_state == SMOOTH_PHASE_STATE_AWAIT_DRAWN &&
|
||||
else if (priv->smooth_phase_state == GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_AWAIT_DRAWN &&
|
||||
priv->paint_is_thaw)
|
||||
{
|
||||
/* First vsync-related animation cycle, we can now compute the phase. We want the phase to satisfy
|
||||
@@ -527,7 +527,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
priv->smoothed_frame_time_phase =
|
||||
positive_modulo (priv->smoothed_frame_time_base - priv->frame_time,
|
||||
frame_interval);
|
||||
priv->smooth_phase_state = SMOOTH_PHASE_STATE_VALID;
|
||||
priv->smooth_phase_state = GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_VALID;
|
||||
}
|
||||
|
||||
if (priv->smoothed_frame_time_base == 0)
|
||||
@@ -539,10 +539,10 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
{
|
||||
/* compute_smooth_frame_time() ensures monotonicity */
|
||||
priv->smoothed_frame_time_base =
|
||||
compute_smooth_frame_time (clock, priv->frame_time + priv->smoothed_frame_time_phase,
|
||||
priv->paint_is_thaw,
|
||||
priv->smoothed_frame_time_base,
|
||||
priv->smoothed_frame_time_period);
|
||||
gdk_frame_clock_idle_compute_smooth_frame_time (clock, priv->frame_time + priv->smoothed_frame_time_phase,
|
||||
priv->paint_is_thaw,
|
||||
priv->smoothed_frame_time_base,
|
||||
priv->smoothed_frame_time_period);
|
||||
}
|
||||
|
||||
priv->smoothed_frame_time_period = frame_interval;
|
||||
@@ -554,7 +554,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
|
||||
timings->frame_time = priv->frame_time;
|
||||
timings->smoothed_frame_time = priv->smoothed_frame_time_base;
|
||||
timings->slept_before = priv->sleep_serial != get_sleep_serial ();
|
||||
timings->slept_before = priv->sleep_serial != gdk_frame_clock_idle_get_sleep_serial ();
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT;
|
||||
|
||||
@@ -688,11 +688,11 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
gint64 smooth_cycle_start = priv->smoothed_frame_time_base - priv->smoothed_frame_time_phase;
|
||||
priv->min_next_frame_time = smooth_cycle_start + priv->smoothed_frame_time_period;
|
||||
|
||||
maybe_start_idle (clock_idle, FALSE);
|
||||
gdk_frame_clock_idle_maybe_start_idle (clock_idle, FALSE);
|
||||
}
|
||||
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
priv->sleep_serial = gdk_frame_clock_idle_get_sleep_serial ();
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock cycle", NULL);
|
||||
|
||||
@@ -707,7 +707,7 @@ gdk_frame_clock_idle_request_phase (GdkFrameClock *clock,
|
||||
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
|
||||
|
||||
priv->requested |= phase;
|
||||
maybe_start_idle (clock_idle, FALSE);
|
||||
gdk_frame_clock_idle_maybe_start_idle (clock_idle, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -727,11 +727,11 @@ gdk_frame_clock_idle_begin_updating (GdkFrameClock *clock)
|
||||
|
||||
if (priv->updating_count == 0)
|
||||
{
|
||||
priv->smooth_phase_state = SMOOTH_PHASE_STATE_AWAIT_FIRST;
|
||||
priv->smooth_phase_state = GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_AWAIT_FIRST;
|
||||
}
|
||||
|
||||
priv->updating_count++;
|
||||
maybe_start_idle (clock_idle, FALSE);
|
||||
gdk_frame_clock_idle_maybe_start_idle (clock_idle, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -743,11 +743,11 @@ gdk_frame_clock_idle_end_updating (GdkFrameClock *clock)
|
||||
g_return_if_fail (priv->updating_count > 0);
|
||||
|
||||
priv->updating_count--;
|
||||
maybe_stop_idle (clock_idle);
|
||||
gdk_frame_clock_idle_maybe_stop_idle (clock_idle);
|
||||
|
||||
if (priv->updating_count == 0)
|
||||
{
|
||||
priv->smooth_phase_state = SMOOTH_PHASE_STATE_VALID;
|
||||
priv->smooth_phase_state = GDK_FRAME_CLOCK_IDLE_SMOOTH_PHASE_STATE_VALID;
|
||||
}
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@@ -772,7 +772,7 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
|
||||
}
|
||||
|
||||
priv->freeze_count++;
|
||||
maybe_stop_idle (clock_idle);
|
||||
gdk_frame_clock_idle_maybe_stop_idle (clock_idle);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -786,7 +786,7 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
|
||||
priv->freeze_count--;
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
{
|
||||
maybe_start_idle (clock_idle, TRUE);
|
||||
gdk_frame_clock_idle_maybe_start_idle (clock_idle, TRUE);
|
||||
/* If nothing is requested so we didn't start an idle, we need
|
||||
* to skip to the end of the state chain, since the idle won't
|
||||
* run and do it for us.
|
||||
@@ -794,7 +794,7 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
|
||||
if (priv->paint_idle_id == 0)
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
priv->sleep_serial = gdk_frame_clock_idle_get_sleep_serial ();
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
|
||||
+98
-55
@@ -122,6 +122,7 @@ struct _GdkGLContextPrivate
|
||||
GdkGLMemoryFlags memory_flags[GDK_MEMORY_N_FORMATS];
|
||||
|
||||
GdkGLFeatures features;
|
||||
guint surface_attached : 1;
|
||||
guint use_khr_debug : 1;
|
||||
guint has_debug_output : 1;
|
||||
guint extensions_checked : 1;
|
||||
@@ -141,16 +142,16 @@ struct _GdkGLContextPrivate
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
GDK_GL_CONTEXT_PROP_0,
|
||||
|
||||
PROP_ALLOWED_APIS,
|
||||
PROP_API,
|
||||
PROP_SHARED_CONTEXT,
|
||||
GDK_GL_CONTEXT_PROP_ALLOWED_APIS,
|
||||
GDK_GL_CONTEXT_PROP_API,
|
||||
GDK_GL_CONTEXT_PROP_SHARED_CONTEXT,
|
||||
|
||||
LAST_PROP
|
||||
GDK_GL_CONTEXT_LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||
static GParamSpec *gdk_gl_context_properties[GDK_GL_CONTEXT_LAST_PROP] = { NULL, };
|
||||
|
||||
/**
|
||||
* gdk_gl_error_quark:
|
||||
@@ -236,11 +237,11 @@ gdk_gl_context_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ALLOWED_APIS:
|
||||
case GDK_GL_CONTEXT_PROP_ALLOWED_APIS:
|
||||
gdk_gl_context_set_allowed_apis (self, g_value_get_flags (value));
|
||||
break;
|
||||
|
||||
case PROP_SHARED_CONTEXT:
|
||||
case GDK_GL_CONTEXT_PROP_SHARED_CONTEXT:
|
||||
g_assert (g_value_get_object (value) == NULL);
|
||||
break;
|
||||
|
||||
@@ -260,15 +261,15 @@ gdk_gl_context_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ALLOWED_APIS:
|
||||
case GDK_GL_CONTEXT_PROP_ALLOWED_APIS:
|
||||
g_value_set_flags (value, priv->allowed_apis);
|
||||
break;
|
||||
|
||||
case PROP_API:
|
||||
case GDK_GL_CONTEXT_PROP_API:
|
||||
g_value_set_flags (value, priv->api);
|
||||
break;
|
||||
|
||||
case PROP_SHARED_CONTEXT:
|
||||
case GDK_GL_CONTEXT_PROP_SHARED_CONTEXT:
|
||||
g_value_set_object (value, NULL);
|
||||
break;
|
||||
|
||||
@@ -717,8 +718,8 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_get_rectangle (painted, i, &rect);
|
||||
rects[j++] = (int) floor (rect.x * scale);
|
||||
rects[j++] = (int) floor ((surface_height - rect.height - rect.y) * scale);
|
||||
rects[j++] = (int) ceil (rect.width * scale);
|
||||
rects[j++] = (int) ceil (rect.height * scale);
|
||||
rects[j++] = (int) ceil ((rect.x + rect.width) * scale) - floor (rect.x * scale);
|
||||
rects[j++] = (int) ceil ((surface_height - rect.y) * scale) - floor ((surface_height - rect.height - rect.y) * scale);
|
||||
}
|
||||
priv->eglSwapBuffersWithDamage (gdk_display_get_egl_display (display), egl_surface, rects, n_rects);
|
||||
g_free (heap_rects);
|
||||
@@ -763,7 +764,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
draw_context_class->surface_resized = gdk_gl_context_surface_resized;
|
||||
|
||||
/**
|
||||
* GdkGLContext:shared-context: (attributes org.gtk.Property.get=gdk_gl_context_get_shared_context)
|
||||
* GdkGLContext:shared-context:
|
||||
*
|
||||
* Always %NULL
|
||||
*
|
||||
@@ -773,7 +774,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
* Deprecated: 4.4: Use [method@Gdk.GLContext.is_shared] to check if contexts
|
||||
* can be shared.
|
||||
*/
|
||||
properties[PROP_SHARED_CONTEXT] =
|
||||
gdk_gl_context_properties[GDK_GL_CONTEXT_PROP_SHARED_CONTEXT] =
|
||||
g_param_spec_object ("shared-context", NULL, NULL,
|
||||
GDK_TYPE_GL_CONTEXT,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -782,13 +783,13 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
G_PARAM_DEPRECATED);
|
||||
|
||||
/**
|
||||
* GdkGLContext:allowed-apis: (attributes org.gtk.Property.get=gdk_gl_context_get_allowed_apis org.gtk.Property.gdk_gl_context_set_allowed_apis)
|
||||
* GdkGLContext:allowed-apis:
|
||||
*
|
||||
* The allowed APIs.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
properties[PROP_ALLOWED_APIS] =
|
||||
gdk_gl_context_properties[GDK_GL_CONTEXT_PROP_ALLOWED_APIS] =
|
||||
g_param_spec_flags ("allowed-apis", NULL, NULL,
|
||||
GDK_TYPE_GL_API,
|
||||
DEFAULT_ALLOWED_APIS,
|
||||
@@ -797,13 +798,13 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkGLContext:api: (attributes org.gtk.Property.get=gdk_gl_context_get_api)
|
||||
* GdkGLContext:api:
|
||||
*
|
||||
* The API currently in use.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
properties[PROP_API] =
|
||||
gdk_gl_context_properties[GDK_GL_CONTEXT_PROP_API] =
|
||||
g_param_spec_flags ("api", NULL, NULL,
|
||||
GDK_TYPE_GL_API,
|
||||
0,
|
||||
@@ -815,7 +816,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
gobject_class->get_property = gdk_gl_context_get_property;
|
||||
gobject_class->dispose = gdk_gl_context_dispose;
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, properties);
|
||||
g_object_class_install_properties (gobject_class, GDK_GL_CONTEXT_LAST_PROP, gdk_gl_context_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -829,20 +830,28 @@ gdk_gl_context_init (GdkGLContext *self)
|
||||
/* Must have called gdk_display_prepare_gl() before */
|
||||
GdkGLContext *
|
||||
gdk_gl_context_new (GdkDisplay *display,
|
||||
GdkSurface *surface)
|
||||
GdkSurface *surface,
|
||||
gboolean surface_attached)
|
||||
{
|
||||
GdkGLContext *shared;
|
||||
GdkGLContextPrivate *priv;
|
||||
GdkGLContext *shared, *result;
|
||||
|
||||
g_assert (surface == NULL || display == gdk_surface_get_display (surface));
|
||||
g_assert (!surface_attached || surface != NULL);
|
||||
|
||||
/* assert gdk_display_prepare_gl() had been called */
|
||||
shared = gdk_display_get_gl_context (display);
|
||||
g_assert (shared);
|
||||
|
||||
return g_object_new (G_OBJECT_TYPE (shared),
|
||||
"display", display,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
result = g_object_new (G_OBJECT_TYPE (shared),
|
||||
"display", display,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
|
||||
priv = gdk_gl_context_get_instance_private (result);
|
||||
priv->surface_attached = surface_attached;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1241,7 +1250,7 @@ gdk_gl_context_is_shared (GdkGLContext *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_set_allowed_apis: (attributes org.gtk.Method.set_property=allowed-apis)
|
||||
* gdk_gl_context_set_allowed_apis:
|
||||
* @self: a GL context
|
||||
* @apis: the allowed APIs
|
||||
*
|
||||
@@ -1268,11 +1277,11 @@ gdk_gl_context_set_allowed_apis (GdkGLContext *self,
|
||||
|
||||
priv->allowed_apis = apis;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ALLOWED_APIS]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_context_properties[GDK_GL_CONTEXT_PROP_ALLOWED_APIS]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_allowed_apis: (attributes org.gtk.Method.get_property=allowed-apis)
|
||||
* gdk_gl_context_get_allowed_apis:
|
||||
* @self: a GL context
|
||||
*
|
||||
* Gets the allowed APIs set via gdk_gl_context_set_allowed_apis().
|
||||
@@ -1292,7 +1301,7 @@ gdk_gl_context_get_allowed_apis (GdkGLContext *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_api: (attributes org.gtk.Method.get_property=api)
|
||||
* gdk_gl_context_get_api:
|
||||
* @self: a GL context
|
||||
*
|
||||
* Gets the API currently in use.
|
||||
@@ -1319,31 +1328,28 @@ gdk_gl_context_is_api_allowed (GdkGLContext *self,
|
||||
GError **error)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
GdkDebugFlags flags;
|
||||
GdkGLAPI allowed_apis;
|
||||
|
||||
allowed_apis = priv->allowed_apis;
|
||||
|
||||
flags = gdk_display_get_debug_flags (gdk_gl_context_get_display (self));
|
||||
|
||||
if (flags & GDK_DEBUG_GL_DISABLE_GLES)
|
||||
if (!gdk_has_feature (GDK_FEATURE_GLES_API))
|
||||
{
|
||||
if (api == GDK_GL_API_GLES)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("OpenGL ES disabled via GDK_DEBUG"));
|
||||
_("OpenGL ES API disabled via GDK_DISABLE"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
allowed_apis &= ~GDK_GL_API_GLES;
|
||||
}
|
||||
|
||||
if (flags & GDK_DEBUG_GL_DISABLE_GL)
|
||||
if (!gdk_has_feature (GDK_FEATURE_GL_API))
|
||||
{
|
||||
if (api == GDK_GL_API_GL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("OpenGL disabled via GDK_DEBUG"));
|
||||
_("OpenGL API disabled via GDK_DISABLE"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1553,7 +1559,7 @@ gdk_gl_context_realize (GdkGLContext *context,
|
||||
{
|
||||
g_assert (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (0, 0)));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_API]);
|
||||
g_object_notify_by_pspec (G_OBJECT (context), gdk_gl_context_properties[GDK_GL_CONTEXT_PROP_API]);
|
||||
}
|
||||
|
||||
return priv->api;
|
||||
@@ -1770,8 +1776,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
|
||||
supported_features = gdk_gl_context_check_features (context);
|
||||
disabled_features = gdk_parse_debug_var ("GDK_GL_DISABLE",
|
||||
gdk_gl_feature_keys,
|
||||
G_N_ELEMENTS (gdk_gl_feature_keys));
|
||||
"GDK_GL_DISABLE can be set to values which cause GDK to disable\n"
|
||||
"certain OpenGL extensions.\n",
|
||||
gdk_gl_feature_keys,
|
||||
G_N_ELEMENTS (gdk_gl_feature_keys));
|
||||
|
||||
priv->features = supported_features & ~disabled_features;
|
||||
|
||||
@@ -1825,12 +1833,22 @@ gdk_gl_context_check_is_current (GdkGLContext *context)
|
||||
void
|
||||
gdk_gl_context_make_current (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
MaskedContext *current, *masked_context;
|
||||
gboolean surfaceless;
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
surfaceless = !gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context));
|
||||
if (priv->surface_attached)
|
||||
{
|
||||
surfaceless = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
surfaceless = !gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
masked_context = mask_context (context, surfaceless);
|
||||
|
||||
current = g_private_get (&thread_current_context);
|
||||
@@ -1895,7 +1913,7 @@ gdk_gl_context_get_surface (GdkGLContext *context)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_shared_context: (attributes org.gtk.Method.get_property=shared-context)
|
||||
* gdk_gl_context_get_shared_context:
|
||||
* @context: a `GdkGLContext`
|
||||
*
|
||||
* Used to retrieves the `GdkGLContext` that this @context share data with.
|
||||
@@ -2019,8 +2037,11 @@ gdk_gl_context_clear_current (void)
|
||||
*
|
||||
* Does a gdk_gl_context_clear_current() if the current context is attached
|
||||
* to @surface, leaves the current context alone otherwise.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): The context that was cleared, so that it can be
|
||||
* re-made current later
|
||||
**/
|
||||
void
|
||||
GdkGLContext *
|
||||
gdk_gl_context_clear_current_if_surface (GdkSurface *surface)
|
||||
{
|
||||
MaskedContext *current;
|
||||
@@ -2031,11 +2052,20 @@ gdk_gl_context_clear_current_if_surface (GdkSurface *surface)
|
||||
GdkGLContext *context = unmask_context (current);
|
||||
|
||||
if (gdk_gl_context_get_surface (context) != surface)
|
||||
return;
|
||||
return NULL;
|
||||
|
||||
g_object_ref (context);
|
||||
|
||||
if (GDK_GL_CONTEXT_GET_CLASS (context)->clear_current (context))
|
||||
g_private_replace (&thread_current_context, NULL);
|
||||
{
|
||||
g_private_replace (&thread_current_context, NULL);
|
||||
return context;
|
||||
}
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2135,17 +2165,30 @@ gboolean
|
||||
gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
|
||||
GError **error)
|
||||
{
|
||||
if (the_gl_backend_type == GDK_GL_NONE ||
|
||||
the_gl_backend_type == backend_type)
|
||||
return TRUE;
|
||||
if (the_gl_backend_type != GDK_GL_NONE &&
|
||||
the_gl_backend_type != backend_type)
|
||||
{
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
/* translators: This is about OpenGL backend names, like
|
||||
* "Trying to use X11 GLX, but EGL is already in use"
|
||||
*/
|
||||
_("Trying to use %s, but %s is already in use"),
|
||||
gl_backend_names[backend_type],
|
||||
gl_backend_names[the_gl_backend_type]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
/* translators: This is about OpenGL backend names, like
|
||||
* "Trying to use X11 GLX, but EGL is already in use" */
|
||||
_("Trying to use %s, but %s is already in use"),
|
||||
gl_backend_names[backend_type],
|
||||
gl_backend_names[the_gl_backend_type]);
|
||||
return FALSE;
|
||||
if ((backend_type == GDK_GL_EGL && !gdk_has_feature (GDK_FEATURE_EGL)) ||
|
||||
(backend_type == GDK_GL_GLX && !gdk_has_feature (GDK_FEATURE_GLX)) ||
|
||||
(backend_type == GDK_GL_WGL && !gdk_has_feature (GDK_FEATURE_WGL)))
|
||||
{
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Trying to use %s, but it is disabled via GDK_DISABLE"),
|
||||
gl_backend_names[backend_type]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*<private>
|
||||
|
||||
@@ -120,10 +120,11 @@ gboolean gdk_gl_backend_can_be_used (GdkGLBackend
|
||||
GError **error);
|
||||
void gdk_gl_backend_use (GdkGLBackend backend_type);
|
||||
|
||||
void gdk_gl_context_clear_current_if_surface (GdkSurface *surface);
|
||||
GdkGLContext * gdk_gl_context_clear_current_if_surface (GdkSurface *surface) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
GdkGLContext * gdk_gl_context_new (GdkDisplay *display,
|
||||
GdkSurface *surface);
|
||||
GdkGLContext * gdk_gl_context_new (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
gboolean surface_attached);
|
||||
|
||||
gboolean gdk_gl_context_is_api_allowed (GdkGLContext *self,
|
||||
GdkGLAPI api,
|
||||
|
||||
+4
-4
@@ -132,9 +132,9 @@ gdk_gl_texture_run (GdkGLTexture *self,
|
||||
while (g_atomic_int_get (&invoke.spinlock) == 0);
|
||||
}
|
||||
|
||||
typedef struct _Download Download;
|
||||
typedef struct _GdkGLTextureDownload GdkGLTextureDownload;
|
||||
|
||||
struct _Download
|
||||
struct _GdkGLTextureDownload
|
||||
{
|
||||
GdkMemoryFormat format;
|
||||
GdkColorState *color_state;
|
||||
@@ -189,7 +189,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
GdkTexture *texture = GDK_TEXTURE (self);
|
||||
GdkMemoryFormat format;
|
||||
gsize expected_stride;
|
||||
Download *download = download_;
|
||||
GdkGLTextureDownload *download = download_;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
GLenum gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
@@ -420,7 +420,7 @@ gdk_gl_texture_download (GdkTexture *texture,
|
||||
gsize stride)
|
||||
{
|
||||
GdkGLTexture *self = GDK_GL_TEXTURE (texture);
|
||||
Download download;
|
||||
GdkGLTextureDownload download;
|
||||
|
||||
if (self->saved)
|
||||
{
|
||||
|
||||
+83
-83
@@ -70,24 +70,24 @@ struct _GdkGLTextureBuilderClass
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONTEXT,
|
||||
PROP_FORMAT,
|
||||
PROP_HAS_MIPMAP,
|
||||
PROP_HEIGHT,
|
||||
PROP_ID,
|
||||
PROP_SYNC,
|
||||
PROP_COLOR_STATE,
|
||||
PROP_UPDATE_REGION,
|
||||
PROP_UPDATE_TEXTURE,
|
||||
PROP_WIDTH,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_0,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_CONTEXT,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_FORMAT,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_HAS_MIPMAP,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_HEIGHT,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_ID,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_SYNC,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_COLOR_STATE,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_REGION,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE,
|
||||
GDK_GL_TEXTURE_BUILDER_PROP_WIDTH,
|
||||
|
||||
N_PROPS
|
||||
GDK_GL_TEXTURE_BUILDER_N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkGLTextureBuilder, gdk_gl_texture_builder, G_TYPE_OBJECT)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
static GParamSpec *gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gdk_gl_texture_builder_dispose (GObject *object)
|
||||
@@ -113,43 +113,43 @@ gdk_gl_texture_builder_get_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONTEXT:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_CONTEXT:
|
||||
g_value_set_object (value, self->context);
|
||||
break;
|
||||
|
||||
case PROP_FORMAT:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_FORMAT:
|
||||
g_value_set_enum (value, self->format);
|
||||
break;
|
||||
|
||||
case PROP_HAS_MIPMAP:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_HAS_MIPMAP:
|
||||
g_value_set_boolean (value, self->has_mipmap);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_HEIGHT:
|
||||
g_value_set_int (value, self->height);
|
||||
break;
|
||||
|
||||
case PROP_ID:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_ID:
|
||||
g_value_set_uint (value, self->id);
|
||||
break;
|
||||
|
||||
case PROP_SYNC:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_SYNC:
|
||||
g_value_set_pointer (value, self->sync);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_COLOR_STATE:
|
||||
g_value_set_boxed (value, self->color_state);
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_REGION:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_REGION:
|
||||
g_value_set_boxed (value, self->update_region);
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_TEXTURE:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE:
|
||||
g_value_set_object (value, self->update_texture);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_WIDTH:
|
||||
g_value_set_int (value, self->width);
|
||||
break;
|
||||
|
||||
@@ -169,43 +169,43 @@ gdk_gl_texture_builder_set_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONTEXT:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_CONTEXT:
|
||||
gdk_gl_texture_builder_set_context (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_FORMAT:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_FORMAT:
|
||||
gdk_gl_texture_builder_set_format (self, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
case PROP_HAS_MIPMAP:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_HAS_MIPMAP:
|
||||
gdk_gl_texture_builder_set_has_mipmap (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_HEIGHT:
|
||||
gdk_gl_texture_builder_set_height (self, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
case PROP_ID:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_ID:
|
||||
gdk_gl_texture_builder_set_id (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_SYNC:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_SYNC:
|
||||
gdk_gl_texture_builder_set_sync (self, g_value_get_pointer (value));
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_COLOR_STATE:
|
||||
gdk_gl_texture_builder_set_color_state (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_REGION:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_REGION:
|
||||
gdk_gl_texture_builder_set_update_region (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_TEXTURE:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE:
|
||||
gdk_gl_texture_builder_set_update_texture (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_GL_TEXTURE_BUILDER_PROP_WIDTH:
|
||||
gdk_gl_texture_builder_set_width (self, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
@@ -225,68 +225,68 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
gobject_class->set_property = gdk_gl_texture_builder_set_property;
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:context: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_context org.gtk.Property.set=gdk_gl_texture_builder_set_context)
|
||||
* GdkGLTextureBuilder:context:
|
||||
*
|
||||
* The context owning the texture.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_CONTEXT] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_CONTEXT] =
|
||||
g_param_spec_object ("context", NULL, NULL,
|
||||
GDK_TYPE_GL_CONTEXT,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:format: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_format org.gtk.Property.set=gdk_gl_texture_builder_set_format)
|
||||
* GdkGLTextureBuilder:format:
|
||||
*
|
||||
* The format when downloading the texture.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_FORMAT] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_FORMAT] =
|
||||
g_param_spec_enum ("format", NULL, NULL,
|
||||
GDK_TYPE_MEMORY_FORMAT,
|
||||
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:has-mipmap: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_has_mipmap org.gtk.Property.set=gdk_gl_texture_builder_set_has_mipmap)
|
||||
* GdkGLTextureBuilder:has-mipmap:
|
||||
*
|
||||
* If the texture has a mipmap.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_HAS_MIPMAP] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_HAS_MIPMAP] =
|
||||
g_param_spec_boolean ("has-mipmap", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:height: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_height org.gtk.Property.set=gdk_gl_texture_builder_set_height)
|
||||
* GdkGLTextureBuilder:height:
|
||||
*
|
||||
* The height of the texture.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_HEIGHT] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_HEIGHT] =
|
||||
g_param_spec_int ("height", NULL, NULL,
|
||||
G_MININT, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:id: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_id org.gtk.Property.set=gdk_gl_texture_builder_set_id)
|
||||
* GdkGLTextureBuilder:id:
|
||||
*
|
||||
* The texture ID to use.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_ID] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_ID] =
|
||||
g_param_spec_uint ("id", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:sync: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_sync org.gtk.Property.set=gdk_gl_texture_builder_set_sync)
|
||||
* GdkGLTextureBuilder:sync:
|
||||
*
|
||||
* An optional `GLSync` object.
|
||||
*
|
||||
@@ -294,7 +294,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_SYNC] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_SYNC] =
|
||||
g_param_spec_pointer ("sync", NULL, NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
@@ -305,48 +305,48 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_STATE] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_COLOR_STATE] =
|
||||
g_param_spec_boxed ("color-state", NULL, NULL,
|
||||
GDK_TYPE_COLOR_STATE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:update-region: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_update_region org.gtk.Property.set=gdk_gl_texture_builder_set_update_region)
|
||||
* GdkGLTextureBuilder:update-region:
|
||||
*
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_UPDATE_REGION] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_REGION] =
|
||||
g_param_spec_boxed ("update-region", NULL, NULL,
|
||||
CAIRO_GOBJECT_TYPE_REGION,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:update-texture: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_update_texture org.gtk.Property.set=gdk_gl_texture_builder_set_update_texture)
|
||||
* GdkGLTextureBuilder:update-texture:
|
||||
*
|
||||
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_UPDATE_TEXTURE] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE] =
|
||||
g_param_spec_object ("update-texture", NULL, NULL,
|
||||
GDK_TYPE_TEXTURE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:width: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_width org.gtk.Property.set=gdk_gl_texture_builder_set_width)
|
||||
* GdkGLTextureBuilder:width:
|
||||
*
|
||||
* The width of the texture.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_WIDTH] =
|
||||
gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_WIDTH] =
|
||||
g_param_spec_int ("width", NULL, NULL,
|
||||
G_MININT, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
g_object_class_install_properties (gobject_class, GDK_GL_TEXTURE_BUILDER_N_PROPS, gdk_gl_texture_builder_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -372,7 +372,7 @@ gdk_gl_texture_builder_new (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_context: (attributes org.gtk.Method.get_property=context)
|
||||
* gdk_gl_texture_builder_get_context:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the context previously set via gdk_gl_texture_builder_set_context() or
|
||||
@@ -391,7 +391,7 @@ gdk_gl_texture_builder_get_context (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_context: (attributes org.gtk.Method.set_property=context)
|
||||
* gdk_gl_texture_builder_set_context:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @context: (nullable): The context the texture belongs to or %NULL to unset
|
||||
*
|
||||
@@ -412,11 +412,11 @@ gdk_gl_texture_builder_set_context (GdkGLTextureBuilder *self,
|
||||
if (!g_set_object (&self->context, context))
|
||||
return;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTEXT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_CONTEXT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* gdk_gl_texture_builder_get_height:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_gl_texture_builder_set_height() or
|
||||
@@ -435,7 +435,7 @@ gdk_gl_texture_builder_get_height (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* gdk_gl_texture_builder_set_height:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @height: The texture's height or 0 to unset
|
||||
*
|
||||
@@ -456,11 +456,11 @@ gdk_gl_texture_builder_set_height (GdkGLTextureBuilder *self,
|
||||
|
||||
self->height = height;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HEIGHT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_HEIGHT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_id: (attributes org.gtk.Method.get_property=id)
|
||||
* gdk_gl_texture_builder_get_id:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the texture id previously set via gdk_gl_texture_builder_set_id() or
|
||||
@@ -479,7 +479,7 @@ gdk_gl_texture_builder_get_id (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_id: (attributes org.gtk.Method.set_property=id)
|
||||
* gdk_gl_texture_builder_set_id:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @id: The texture id to be used for creating the texture
|
||||
*
|
||||
@@ -502,11 +502,11 @@ gdk_gl_texture_builder_set_id (GdkGLTextureBuilder *self,
|
||||
|
||||
self->id = id;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ID]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_ID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* gdk_gl_texture_builder_get_width:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_gl_texture_builder_set_width() or
|
||||
@@ -525,7 +525,7 @@ gdk_gl_texture_builder_get_width (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* gdk_gl_texture_builder_set_width:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -546,11 +546,11 @@ gdk_gl_texture_builder_set_width (GdkGLTextureBuilder *self,
|
||||
|
||||
self->width = width;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_WIDTH]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_WIDTH]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_has_mipmap: (attributes org.gtk.Method.get_property=has-mipmap)
|
||||
* gdk_gl_texture_builder_get_has_mipmap:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets whether the texture has a mipmap.
|
||||
@@ -568,7 +568,7 @@ gdk_gl_texture_builder_get_has_mipmap (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_has_mipmap: (attributes org.gtk.Method.set_property=has-mipmap)
|
||||
* gdk_gl_texture_builder_set_has_mipmap:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @has_mipmap: Whether the texture has a mipmap
|
||||
*
|
||||
@@ -590,11 +590,11 @@ gdk_gl_texture_builder_set_has_mipmap (GdkGLTextureBuilder *self,
|
||||
|
||||
self->has_mipmap = has_mipmap;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HAS_MIPMAP]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_HAS_MIPMAP]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_sync: (attributes org.gtk.Method.get_property=sync)
|
||||
* gdk_gl_texture_builder_get_sync:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the `GLsync` previously set via gdk_gl_texture_builder_set_sync().
|
||||
@@ -612,7 +612,7 @@ gdk_gl_texture_builder_get_sync (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_sync: (attributes org.gtk.Method.set_property=sync)
|
||||
* gdk_gl_texture_builder_set_sync:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @sync: (nullable): the GLSync object
|
||||
*
|
||||
@@ -638,11 +638,11 @@ gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
|
||||
|
||||
self->sync = sync;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SYNC]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_SYNC]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_color_state: (attributes org.gtk.Method.get_property=color-state)
|
||||
* gdk_gl_texture_builder_get_color_state:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the color state previously set via gdk_gl_texture_builder_set_color_state().
|
||||
@@ -660,7 +660,7 @@ gdk_gl_texture_builder_get_color_state (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_color_state: (attributes org.gtk.Method.set_property=color-state)
|
||||
* gdk_gl_texture_builder_set_color_state:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @color_state: a `GdkColorState`
|
||||
*
|
||||
@@ -683,11 +683,11 @@ gdk_gl_texture_builder_set_color_state (GdkGLTextureBuilder *self,
|
||||
|
||||
g_clear_pointer (&self->color_state, gdk_color_state_unref);
|
||||
self->color_state = gdk_color_state_ref (color_state);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_COLOR_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_COLOR_STATE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_format: (attributes org.gtk.Method.get_property=format)
|
||||
* gdk_gl_texture_builder_get_format:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_gl_texture_builder_set_format().
|
||||
@@ -705,7 +705,7 @@ gdk_gl_texture_builder_get_format (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_format: (attributes org.gtk.Method.set_property=format)
|
||||
* gdk_gl_texture_builder_set_format:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @format: The texture's format
|
||||
*
|
||||
@@ -739,11 +739,11 @@ gdk_gl_texture_builder_set_format (GdkGLTextureBuilder *self,
|
||||
|
||||
self->format = format;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FORMAT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_FORMAT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* gdk_gl_texture_builder_get_update_texture:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
|
||||
@@ -762,7 +762,7 @@ gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* gdk_gl_texture_builder_set_update_texture:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -781,11 +781,11 @@ gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
|
||||
if (!g_set_object (&self->update_texture, texture))
|
||||
return;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_TEXTURE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* gdk_gl_texture_builder_get_update_region:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
|
||||
@@ -804,7 +804,7 @@ gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* gdk_gl_texture_builder_set_update_region:
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
@@ -835,7 +835,7 @@ gdk_gl_texture_builder_set_update_region (GdkGLTextureBuilder *self,
|
||||
if (region)
|
||||
self->update_region = cairo_region_reference (region);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_REGION]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_gl_texture_builder_properties[GDK_GL_TEXTURE_BUILDER_PROP_UPDATE_REGION]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+16
-16
@@ -35,20 +35,20 @@
|
||||
#include <string.h>
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
LAST_PROP
|
||||
GDK_KEYS_PROP_0,
|
||||
GDK_KEYS_PROP_DISPLAY,
|
||||
GDK_KEYS_LAST_PROP
|
||||
};
|
||||
|
||||
enum {
|
||||
DIRECTION_CHANGED,
|
||||
KEYS_CHANGED,
|
||||
STATE_CHANGED,
|
||||
LAST_SIGNAL
|
||||
GDK_KEYS_DIRECTION_CHANGED,
|
||||
GDK_KEYS_KEYS_CHANGED,
|
||||
GDK_KEYS_STATE_CHANGED,
|
||||
GDK_KEYS_LAST_SIGNAL
|
||||
};
|
||||
|
||||
static GParamSpec *props[LAST_PROP] = { NULL, };
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static GParamSpec *gdk_keys_properties[GDK_KEYS_LAST_PROP] = { NULL, };
|
||||
static guint gdk_keys_signals[GDK_KEYS_LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT)
|
||||
|
||||
@@ -62,7 +62,7 @@ gdk_keymap_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_KEYS_PROP_DISPLAY:
|
||||
g_value_set_object (value, keymap->display);
|
||||
break;
|
||||
default:
|
||||
@@ -80,7 +80,7 @@ gdk_keymap_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_KEYS_PROP_DISPLAY:
|
||||
keymap->display = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
@@ -127,12 +127,12 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
|
||||
|
||||
klass->keys_changed = gdk_keymap_keys_changed;
|
||||
|
||||
props[PROP_DISPLAY] =
|
||||
gdk_keys_properties[GDK_KEYS_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
g_object_class_install_properties (object_class, GDK_KEYS_LAST_PROP, gdk_keys_properties);
|
||||
|
||||
/**
|
||||
* GdkKeymap::direction-changed:
|
||||
@@ -142,7 +142,7 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
|
||||
*
|
||||
* See gdk_keymap_get_direction().
|
||||
*/
|
||||
signals[DIRECTION_CHANGED] =
|
||||
gdk_keys_signals[GDK_KEYS_DIRECTION_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("direction-changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -159,7 +159,7 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
|
||||
* The ::keys-changed signal is emitted when the mapping represented by
|
||||
* @keymap changes.
|
||||
*/
|
||||
signals[KEYS_CHANGED] =
|
||||
gdk_keys_signals[GDK_KEYS_KEYS_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("keys-changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
@@ -177,7 +177,7 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
|
||||
* keyboard changes, e.g when Caps Lock is turned on or off.
|
||||
* See gdk_keymap_get_caps_lock_state().
|
||||
*/
|
||||
signals[STATE_CHANGED] =
|
||||
gdk_keys_signals[GDK_KEYS_STATE_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("state-changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
|
||||
@@ -96,8 +96,7 @@ print OUT_GDKKEYSYMS<<EOF;
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_KEYSYMS_H__
|
||||
#define __GDK_KEYSYMS_H__
|
||||
#pragma once
|
||||
|
||||
|
||||
EOF
|
||||
@@ -165,8 +164,6 @@ close IN_XF86KEYSYM;
|
||||
|
||||
|
||||
print OUT_GDKKEYSYMS<<EOF;
|
||||
|
||||
#endif /* __GDK_KEYSYMS_H__ */
|
||||
EOF
|
||||
|
||||
printf "We just finished converting keysymdef.h to gdkkeysyms.h\nThank you\n";
|
||||
|
||||
+11
-1
@@ -297,8 +297,11 @@
|
||||
#define GDK_KEY_dead_u 0xfe88
|
||||
#define GDK_KEY_dead_U 0xfe89
|
||||
#define GDK_KEY_dead_small_schwa 0xfe8a
|
||||
#define GDK_KEY_dead_schwa 0xfe8a
|
||||
#define GDK_KEY_dead_capital_schwa 0xfe8b
|
||||
#define GDK_KEY_dead_SCHWA 0xfe8b
|
||||
#define GDK_KEY_dead_greek 0xfe8c
|
||||
#define GDK_KEY_dead_hamza 0xfe8d
|
||||
#define GDK_KEY_First_Virtual_Screen 0xfed0
|
||||
#define GDK_KEY_Prev_Virtual_Screen 0xfed1
|
||||
#define GDK_KEY_Next_Virtual_Screen 0xfed2
|
||||
@@ -490,6 +493,7 @@
|
||||
#define GDK_KEY_copyright 0x0a9
|
||||
#define GDK_KEY_ordfeminine 0x0aa
|
||||
#define GDK_KEY_guillemotleft 0x0ab
|
||||
#define GDK_KEY_guillemetleft 0x0ab
|
||||
#define GDK_KEY_notsign 0x0ac
|
||||
#define GDK_KEY_hyphen 0x0ad
|
||||
#define GDK_KEY_registered 0x0ae
|
||||
@@ -505,7 +509,9 @@
|
||||
#define GDK_KEY_cedilla 0x0b8
|
||||
#define GDK_KEY_onesuperior 0x0b9
|
||||
#define GDK_KEY_masculine 0x0ba
|
||||
#define GDK_KEY_ordmasculine 0x0ba
|
||||
#define GDK_KEY_guillemotright 0x0bb
|
||||
#define GDK_KEY_guillemetright 0x0bb
|
||||
#define GDK_KEY_onequarter 0x0bc
|
||||
#define GDK_KEY_onehalf 0x0bd
|
||||
#define GDK_KEY_threequarters 0x0be
|
||||
@@ -1743,6 +1749,11 @@
|
||||
#define GDK_KEY_ohorn 0x10001a1
|
||||
#define GDK_KEY_Uhorn 0x10001af
|
||||
#define GDK_KEY_uhorn 0x10001b0
|
||||
#define GDK_KEY_combining_tilde 0x1000303
|
||||
#define GDK_KEY_combining_grave 0x1000300
|
||||
#define GDK_KEY_combining_acute 0x1000301
|
||||
#define GDK_KEY_combining_hook 0x1000309
|
||||
#define GDK_KEY_combining_belowdot 0x1000323
|
||||
#define GDK_KEY_EcuSign 0x10020a0
|
||||
#define GDK_KEY_ColonSign 0x10020a1
|
||||
#define GDK_KEY_CruzeiroSign 0x10020a2
|
||||
@@ -2313,4 +2324,3 @@
|
||||
#define GDK_KEY_Prev_VMode 0x1008fe23
|
||||
#define GDK_KEY_LogWindowTree 0x1008fe24
|
||||
#define GDK_KEY_LogGrabInfo 0x1008fe25
|
||||
|
||||
|
||||
+754
-307
File diff suppressed because it is too large
Load Diff
@@ -66,6 +66,7 @@ GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth
|
||||
GdkMemoryDepth depth2) G_GNUC_CONST;
|
||||
GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||
GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||
const char * gdk_memory_depth_get_name (GdkMemoryDepth depth);
|
||||
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
@@ -109,6 +110,16 @@ void gdk_memory_convert_color_state (guchar
|
||||
GdkColorState *dest_color_state,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void gdk_memory_mipmap (guchar *dest,
|
||||
gsize dest_stride,
|
||||
GdkMemoryFormat dest_format,
|
||||
const guchar *src,
|
||||
gsize src_stride,
|
||||
GdkMemoryFormat src_format,
|
||||
gsize src_width,
|
||||
gsize src_height,
|
||||
guint lod_level,
|
||||
gboolean linear);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -111,7 +111,7 @@ gdk_memory_sanitize (GBytes *bytes,
|
||||
stride % align == 0)
|
||||
{
|
||||
*out_stride = stride;
|
||||
return g_bytes_ref (bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
bpp = gdk_memory_format_bytes_per_pixel (format);
|
||||
@@ -122,6 +122,8 @@ gdk_memory_sanitize (GBytes *bytes,
|
||||
for (y = 0; y < height; y++)
|
||||
memcpy (copy + y * copy_stride, data + y * stride, bpp * width);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
*out_stride = copy_stride;
|
||||
return g_bytes_new_take (copy, copy_stride * height);
|
||||
}
|
||||
@@ -197,7 +199,7 @@ gdk_memory_texture_new (int width,
|
||||
/* needs to be this complex to support subtexture of the bottom right part */
|
||||
g_return_val_if_fail (g_bytes_get_size (bytes) >= gdk_memory_format_min_buffer_size (format, stride, width, height), NULL);
|
||||
|
||||
bytes = gdk_memory_sanitize (bytes, width, height, format, stride, &stride);
|
||||
bytes = gdk_memory_sanitize (g_bytes_ref (bytes), width, height, format, stride, &stride);
|
||||
|
||||
self = g_object_new (GDK_TYPE_MEMORY_TEXTURE,
|
||||
"width", width,
|
||||
|
||||
@@ -67,22 +67,22 @@ struct _GdkMemoryTextureBuilderClass
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BYTES,
|
||||
PROP_COLOR_STATE,
|
||||
PROP_FORMAT,
|
||||
PROP_HEIGHT,
|
||||
PROP_STRIDE,
|
||||
PROP_UPDATE_REGION,
|
||||
PROP_UPDATE_TEXTURE,
|
||||
PROP_WIDTH,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_0,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_BYTES,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_COLOR_STATE,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_FORMAT,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_HEIGHT,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_STRIDE,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_REGION,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE,
|
||||
GDK_MEMORY_TEXTURE_BUILDER_PROP_WIDTH,
|
||||
|
||||
N_PROPS
|
||||
GDK_MEMORY_TEXTURE_BUILDER_N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMemoryTextureBuilder, gdk_memory_texture_builder, G_TYPE_OBJECT)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
static GParamSpec *gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gdk_memory_texture_builder_dispose (GObject *object)
|
||||
@@ -108,35 +108,35 @@ gdk_memory_texture_builder_get_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_BYTES:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_BYTES:
|
||||
g_value_set_boxed (value, self->bytes);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_COLOR_STATE:
|
||||
g_value_set_boxed (value, self->color_state);
|
||||
break;
|
||||
|
||||
case PROP_FORMAT:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_FORMAT:
|
||||
g_value_set_enum (value, self->format);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_HEIGHT:
|
||||
g_value_set_int (value, self->height);
|
||||
break;
|
||||
|
||||
case PROP_STRIDE:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_STRIDE:
|
||||
g_value_set_uint64 (value, self->stride);
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_REGION:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_REGION:
|
||||
g_value_set_boxed (value, self->update_region);
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_TEXTURE:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE:
|
||||
g_value_set_object (value, self->update_texture);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_WIDTH:
|
||||
g_value_set_int (value, self->width);
|
||||
break;
|
||||
|
||||
@@ -156,35 +156,35 @@ gdk_memory_texture_builder_set_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_BYTES:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_BYTES:
|
||||
gdk_memory_texture_builder_set_bytes (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_COLOR_STATE:
|
||||
gdk_memory_texture_builder_set_color_state (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_FORMAT:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_FORMAT:
|
||||
gdk_memory_texture_builder_set_format (self, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_HEIGHT:
|
||||
gdk_memory_texture_builder_set_height (self, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
case PROP_STRIDE:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_STRIDE:
|
||||
gdk_memory_texture_builder_set_stride (self, g_value_get_uint64 (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_REGION:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_REGION:
|
||||
gdk_memory_texture_builder_set_update_region (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_TEXTURE:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE:
|
||||
gdk_memory_texture_builder_set_update_texture (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_MEMORY_TEXTURE_BUILDER_PROP_WIDTH:
|
||||
gdk_memory_texture_builder_set_width (self, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
@@ -210,7 +210,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_BYTES] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_BYTES] =
|
||||
g_param_spec_boxed ("bytes", NULL, NULL,
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -222,7 +222,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_STATE] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_COLOR_STATE] =
|
||||
g_param_spec_boxed ("color-state", NULL, NULL,
|
||||
GDK_TYPE_COLOR_STATE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -234,7 +234,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_FORMAT] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_FORMAT] =
|
||||
g_param_spec_enum ("format", NULL, NULL,
|
||||
GDK_TYPE_MEMORY_FORMAT,
|
||||
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
@@ -247,7 +247,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_HEIGHT] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_HEIGHT] =
|
||||
g_param_spec_int ("height", NULL, NULL,
|
||||
G_MININT, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -262,7 +262,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_STRIDE] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_STRIDE] =
|
||||
g_param_spec_uint64 ("stride", NULL, NULL,
|
||||
0, G_MAXUINT64, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -274,7 +274,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_UPDATE_REGION] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_REGION] =
|
||||
g_param_spec_boxed ("update-region", NULL, NULL,
|
||||
CAIRO_GOBJECT_TYPE_REGION,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -286,7 +286,7 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_UPDATE_TEXTURE] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE] =
|
||||
g_param_spec_object ("update-texture", NULL, NULL,
|
||||
GDK_TYPE_TEXTURE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
@@ -298,12 +298,12 @@ gdk_memory_texture_builder_class_init (GdkMemoryTextureBuilderClass *klass)
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_WIDTH] =
|
||||
gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_WIDTH] =
|
||||
g_param_spec_int ("width", NULL, NULL,
|
||||
G_MININT, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
g_object_class_install_properties (gobject_class, GDK_MEMORY_TEXTURE_BUILDER_N_PROPS, gdk_memory_texture_builder_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -348,7 +348,7 @@ gdk_memory_texture_builder_get_bytes (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_bytes: (attributes org.gtk.Method.set_property=bytes)
|
||||
* gdk_memory_texture_builder_set_bytes:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @bytes: (nullable): The bytes the texture shows or %NULL to unset
|
||||
*
|
||||
@@ -373,11 +373,11 @@ gdk_memory_texture_builder_set_bytes (GdkMemoryTextureBuilder *self,
|
||||
if (bytes)
|
||||
g_bytes_ref (bytes);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BYTES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_BYTES]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_color_state: (attributes org.gtk.Method.get_property=color-state)
|
||||
* gdk_memory_texture_builder_get_color_state:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
*
|
||||
* Gets the colorstate previously set via gdk_memory_texture_builder_set_color_state().
|
||||
@@ -395,7 +395,7 @@ gdk_memory_texture_builder_get_color_state (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_color_state: (attributes org.gtk.Method.set_property=color-state)
|
||||
* gdk_memory_texture_builder_set_color_state:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @color_state: (nullable): The colorstate describing the data
|
||||
*
|
||||
@@ -421,11 +421,11 @@ gdk_memory_texture_builder_set_color_state (GdkMemoryTextureBuilder *self,
|
||||
if (color_state)
|
||||
gdk_color_state_ref (color_state);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_COLOR_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_COLOR_STATE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* gdk_memory_texture_builder_get_height:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_memory_texture_builder_set_height()
|
||||
@@ -444,7 +444,7 @@ gdk_memory_texture_builder_get_height (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* gdk_memory_texture_builder_set_height:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @height: The texture's height or 0 to unset
|
||||
*
|
||||
@@ -465,11 +465,11 @@ gdk_memory_texture_builder_set_height (GdkMemoryTextureBuilder *self,
|
||||
|
||||
self->height = height;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HEIGHT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_HEIGHT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* gdk_memory_texture_builder_get_width:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_memory_texture_builder_set_width()
|
||||
@@ -488,7 +488,7 @@ gdk_memory_texture_builder_get_width (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* gdk_memory_texture_builder_set_width:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -509,10 +509,9 @@ gdk_memory_texture_builder_set_width (GdkMemoryTextureBuilder *self,
|
||||
|
||||
self->width = width;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_WIDTH]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_WIDTH]);
|
||||
}
|
||||
|
||||
/* gdk_memory_texture_builder_get_stride: (attributes org.gtk.Method.get_property=stride) */
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_stride:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
@@ -531,7 +530,6 @@ gdk_memory_texture_builder_get_stride (GdkMemoryTextureBuilder *self)
|
||||
return self->stride;
|
||||
}
|
||||
|
||||
/* gdk_memory_texture_builder_set_stride: (attributes org.gtk.Method.set_property=stride) */
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_stride:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
@@ -554,11 +552,11 @@ gdk_memory_texture_builder_set_stride (GdkMemoryTextureBuilder *self,
|
||||
|
||||
self->stride = stride;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STRIDE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_STRIDE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_format: (attributes org.gtk.Method.get_property=format)
|
||||
* gdk_memory_texture_builder_get_format:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_memory_texture_builder_set_format().
|
||||
@@ -576,7 +574,7 @@ gdk_memory_texture_builder_get_format (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_format: (attributes org.gtk.Method.set_property=format)
|
||||
* gdk_memory_texture_builder_set_format:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @format: The texture's format
|
||||
*
|
||||
@@ -597,11 +595,11 @@ gdk_memory_texture_builder_set_format (GdkMemoryTextureBuilder *self,
|
||||
|
||||
self->format = format;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FORMAT]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_FORMAT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* gdk_memory_texture_builder_get_update_texture:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_memory_texture_builder_set_update_texture()
|
||||
@@ -620,7 +618,7 @@ gdk_memory_texture_builder_get_update_texture (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* gdk_memory_texture_builder_set_update_texture:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -640,11 +638,11 @@ gdk_memory_texture_builder_set_update_texture (GdkMemoryTextureBuilder *self,
|
||||
if (!g_set_object (&self->update_texture, texture))
|
||||
return;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_TEXTURE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_TEXTURE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* gdk_memory_texture_builder_get_update_region:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_memory_texture_builder_set_update_region()
|
||||
@@ -663,7 +661,7 @@ gdk_memory_texture_builder_get_update_region (GdkMemoryTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_memory_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* gdk_memory_texture_builder_set_update_region:
|
||||
* @self: a `GdkMemoryTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
@@ -695,7 +693,7 @@ gdk_memory_texture_builder_set_update_region (GdkMemoryTextureBuilder *self,
|
||||
if (region)
|
||||
self->update_region = cairo_region_reference (region);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_REGION]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gdk_memory_texture_builder_properties[GDK_MEMORY_TEXTURE_BUILDER_PROP_UPDATE_REGION]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+77
-77
@@ -41,31 +41,31 @@
|
||||
*/
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DESCRIPTION,
|
||||
PROP_DISPLAY,
|
||||
PROP_MANUFACTURER,
|
||||
PROP_MODEL,
|
||||
PROP_CONNECTOR,
|
||||
PROP_SCALE_FACTOR,
|
||||
PROP_SCALE,
|
||||
PROP_GEOMETRY,
|
||||
PROP_WIDTH_MM,
|
||||
PROP_HEIGHT_MM,
|
||||
PROP_REFRESH_RATE,
|
||||
PROP_SUBPIXEL_LAYOUT,
|
||||
PROP_VALID,
|
||||
LAST_PROP
|
||||
GDK_MONITOR_PROP_0,
|
||||
GDK_MONITOR_PROP_DESCRIPTION,
|
||||
GDK_MONITOR_PROP_DISPLAY,
|
||||
GDK_MONITOR_PROP_MANUFACTURER,
|
||||
GDK_MONITOR_PROP_MODEL,
|
||||
GDK_MONITOR_PROP_CONNECTOR,
|
||||
GDK_MONITOR_PROP_SCALE_FACTOR,
|
||||
GDK_MONITOR_PROP_SCALE,
|
||||
GDK_MONITOR_PROP_GEOMETRY,
|
||||
GDK_MONITOR_PROP_WIDTH_MM,
|
||||
GDK_MONITOR_PROP_HEIGHT_MM,
|
||||
GDK_MONITOR_PROP_REFRESH_RATE,
|
||||
GDK_MONITOR_PROP_SUBPIXEL_LAYOUT,
|
||||
GDK_MONITOR_PROP_VALID,
|
||||
GDK_MONITOR_LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *props[LAST_PROP] = { NULL, };
|
||||
static GParamSpec *gdk_monitor_properties[GDK_MONITOR_LAST_PROP] = { NULL, };
|
||||
|
||||
enum {
|
||||
INVALIDATE,
|
||||
LAST_SIGNAL
|
||||
GDK_MONITOR_INVALIDATE,
|
||||
GDK_MONITOR_LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static guint gdk_monitor_signals[GDK_MONITOR_LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (GdkMonitor, gdk_monitor, G_TYPE_OBJECT)
|
||||
|
||||
@@ -88,55 +88,55 @@ gdk_monitor_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DESCRIPTION:
|
||||
case GDK_MONITOR_PROP_DESCRIPTION:
|
||||
g_value_set_string (value, monitor->description);
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
case GDK_MONITOR_PROP_DISPLAY:
|
||||
g_value_set_object (value, monitor->display);
|
||||
break;
|
||||
|
||||
case PROP_MANUFACTURER:
|
||||
case GDK_MONITOR_PROP_MANUFACTURER:
|
||||
g_value_set_string (value, monitor->manufacturer);
|
||||
break;
|
||||
|
||||
case PROP_MODEL:
|
||||
case GDK_MONITOR_PROP_MODEL:
|
||||
g_value_set_string (value, monitor->model);
|
||||
break;
|
||||
|
||||
case PROP_CONNECTOR:
|
||||
case GDK_MONITOR_PROP_CONNECTOR:
|
||||
g_value_set_string (value, monitor->connector);
|
||||
break;
|
||||
|
||||
case PROP_SCALE_FACTOR:
|
||||
case GDK_MONITOR_PROP_SCALE_FACTOR:
|
||||
g_value_set_int (value, monitor->scale_factor);
|
||||
break;
|
||||
|
||||
case PROP_SCALE:
|
||||
case GDK_MONITOR_PROP_SCALE:
|
||||
g_value_set_double (value, monitor->scale);
|
||||
break;
|
||||
|
||||
case PROP_GEOMETRY:
|
||||
case GDK_MONITOR_PROP_GEOMETRY:
|
||||
g_value_set_boxed (value, &monitor->geometry);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH_MM:
|
||||
case GDK_MONITOR_PROP_WIDTH_MM:
|
||||
g_value_set_int (value, monitor->width_mm);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT_MM:
|
||||
case GDK_MONITOR_PROP_HEIGHT_MM:
|
||||
g_value_set_int (value, monitor->height_mm);
|
||||
break;
|
||||
|
||||
case PROP_REFRESH_RATE:
|
||||
case GDK_MONITOR_PROP_REFRESH_RATE:
|
||||
g_value_set_int (value, monitor->refresh_rate);
|
||||
break;
|
||||
|
||||
case PROP_SUBPIXEL_LAYOUT:
|
||||
case GDK_MONITOR_PROP_SUBPIXEL_LAYOUT:
|
||||
g_value_set_enum (value, monitor->subpixel_layout);
|
||||
break;
|
||||
|
||||
case PROP_VALID:
|
||||
case GDK_MONITOR_PROP_VALID:
|
||||
g_value_set_boolean (value, monitor->valid);
|
||||
break;
|
||||
|
||||
@@ -155,7 +155,7 @@ gdk_monitor_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_MONITOR_PROP_DISPLAY:
|
||||
monitor->display = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
@@ -187,148 +187,148 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
object_class->set_property = gdk_monitor_set_property;
|
||||
|
||||
/**
|
||||
* GdkMonitor:description: (attributes org.gtk.Property.get=gdk_monitor_get_description)
|
||||
* GdkMonitor:description:
|
||||
*
|
||||
* A short description of the monitor, meant for display to the user.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
props[PROP_DESCRIPTION] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_DESCRIPTION] =
|
||||
g_param_spec_string ("description", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:display: (attributes org.gtk.Property.get=gdk_monitor_get_display)
|
||||
* GdkMonitor:display:
|
||||
*
|
||||
* The `GdkDisplay` of the monitor.
|
||||
*/
|
||||
props[PROP_DISPLAY] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:manufacturer: (attributes org.gtk.Property.get=gdk_monitor_get_manufacturer)
|
||||
* GdkMonitor:manufacturer:
|
||||
*
|
||||
* The manufacturer name.
|
||||
*/
|
||||
props[PROP_MANUFACTURER] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_MANUFACTURER] =
|
||||
g_param_spec_string ("manufacturer", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:model: (attributes org.gtk.Property.get=gdk_monitor_get_model)
|
||||
* GdkMonitor:model:
|
||||
*
|
||||
* The model name.
|
||||
*/
|
||||
props[PROP_MODEL] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_MODEL] =
|
||||
g_param_spec_string ("model", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:connector: (attributes org.gtk.Property.get=gdk_monitor_get_connector)
|
||||
* GdkMonitor:connector:
|
||||
*
|
||||
* The connector name.
|
||||
*/
|
||||
props[PROP_CONNECTOR] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_CONNECTOR] =
|
||||
g_param_spec_string ("connector", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:scale-factor: (attributes org.gtk.Property.get=gdk_monitor_get_scale_factor)
|
||||
* GdkMonitor:scale-factor:
|
||||
*
|
||||
* The scale factor.
|
||||
*
|
||||
* The scale factor is the next larger integer,
|
||||
* compared to [property@Gdk.Surface:scale].
|
||||
*/
|
||||
props[PROP_SCALE_FACTOR] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_SCALE_FACTOR] =
|
||||
g_param_spec_int ("scale-factor", NULL, NULL,
|
||||
1, G_MAXINT,
|
||||
1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:scale: (attributes org.gtk.Property.get=gdk_monitor_get_scale)
|
||||
* GdkMonitor:scale:
|
||||
*
|
||||
* The scale of the monitor.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_SCALE] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_SCALE] =
|
||||
g_param_spec_double ("scale", NULL, NULL,
|
||||
1., G_MAXDOUBLE, 1.,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:geometry: (attributes org.gtk.Property.get=gdk_monitor_get_geometry)
|
||||
* GdkMonitor:geometry:
|
||||
*
|
||||
* The geometry of the monitor.
|
||||
*/
|
||||
props[PROP_GEOMETRY] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_GEOMETRY] =
|
||||
g_param_spec_boxed ("geometry", NULL, NULL,
|
||||
GDK_TYPE_RECTANGLE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:width-mm: (attributes org.gtk.Property.get=gdk_monitor_get_width_mm)
|
||||
* GdkMonitor:width-mm:
|
||||
*
|
||||
* The width of the monitor, in millimeters.
|
||||
*/
|
||||
props[PROP_WIDTH_MM] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_WIDTH_MM] =
|
||||
g_param_spec_int ("width-mm", NULL, NULL,
|
||||
0, G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:height-mm: (attributes org.gtk.Property.get=gdk_monitor_get_height_mm)
|
||||
* GdkMonitor:height-mm:
|
||||
*
|
||||
* The height of the monitor, in millimeters.
|
||||
*/
|
||||
props[PROP_HEIGHT_MM] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_HEIGHT_MM] =
|
||||
g_param_spec_int ("height-mm", NULL, NULL,
|
||||
0, G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:refresh-rate: (attributes org.gtk.Property.get=gdk_monitor_get_refresh_rate)
|
||||
* GdkMonitor:refresh-rate:
|
||||
*
|
||||
* The refresh rate, in milli-Hertz.
|
||||
*/
|
||||
props[PROP_REFRESH_RATE] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_REFRESH_RATE] =
|
||||
g_param_spec_int ("refresh-rate", NULL, NULL,
|
||||
0, G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:subpixel-layout: (attributes org.gtk.Property.get=gdk_monitor_get_subpixel_layout)
|
||||
* GdkMonitor:subpixel-layout:
|
||||
*
|
||||
* The subpixel layout.
|
||||
*/
|
||||
props[PROP_SUBPIXEL_LAYOUT] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_SUBPIXEL_LAYOUT] =
|
||||
g_param_spec_enum ("subpixel-layout", NULL, NULL,
|
||||
GDK_TYPE_SUBPIXEL_LAYOUT,
|
||||
GDK_SUBPIXEL_LAYOUT_UNKNOWN,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:valid: (attributes org.gtk.Property.get=gdk_monitor_is_valid)
|
||||
* GdkMonitor:valid: (getter is_valid)
|
||||
*
|
||||
* Whether the object is still valid.
|
||||
*/
|
||||
props[PROP_VALID] =
|
||||
gdk_monitor_properties[GDK_MONITOR_PROP_VALID] =
|
||||
g_param_spec_boolean ("valid", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
g_object_class_install_properties (object_class, GDK_MONITOR_LAST_PROP, gdk_monitor_properties);
|
||||
|
||||
/**
|
||||
* GdkMonitor::invalidate:
|
||||
@@ -336,7 +336,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
*
|
||||
* Emitted when the output represented by @monitor gets disconnected.
|
||||
*/
|
||||
signals[INVALIDATE] = g_signal_new (g_intern_static_string ("invalidate"),
|
||||
gdk_monitor_signals[GDK_MONITOR_INVALIDATE] = g_signal_new (g_intern_static_string ("invalidate"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
@@ -346,7 +346,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_monitor_get_display:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the display that this monitor belongs to.
|
||||
@@ -362,7 +362,7 @@ gdk_monitor_get_display (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_geometry: (attributes org.gtk.Method.get_property=geometry)
|
||||
* gdk_monitor_get_geometry:
|
||||
* @monitor: a `GdkMonitor`
|
||||
* @geometry: (out): a `GdkRectangle` to be filled with the monitor geometry
|
||||
*
|
||||
@@ -383,7 +383,7 @@ gdk_monitor_get_geometry (GdkMonitor *monitor,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_width_mm: (attributes org.gtk.Method.get_property=width-mm)
|
||||
* gdk_monitor_get_width_mm:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the width in millimeters of the monitor.
|
||||
@@ -399,7 +399,7 @@ gdk_monitor_get_width_mm (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_height_mm: (attributes org.gtk.Method.get_property=height-mm)
|
||||
* gdk_monitor_get_height_mm:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the height in millimeters of the monitor.
|
||||
@@ -415,7 +415,7 @@ gdk_monitor_get_height_mm (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_connector: (attributes org.gtk.Method.get_property=connector)
|
||||
* gdk_monitor_get_connector:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the name of the monitor's connector, if available.
|
||||
@@ -435,7 +435,7 @@ gdk_monitor_get_connector (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_manufacturer: (attributes org.gtk.Method.get_property=manufacturer)
|
||||
* gdk_monitor_get_manufacturer:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the name or PNP ID of the monitor's manufacturer.
|
||||
@@ -457,7 +457,7 @@ gdk_monitor_get_manufacturer (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_model: (attributes org.gtk.Method.get_property=model)
|
||||
* gdk_monitor_get_model:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the string identifying the monitor model, if available.
|
||||
@@ -473,7 +473,7 @@ gdk_monitor_get_model (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_scale_factor: (attributes org.gtk.Method.get_property=scale-factor)
|
||||
* gdk_monitor_get_scale_factor:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the internal scale factor that maps from monitor coordinates
|
||||
@@ -497,7 +497,7 @@ gdk_monitor_get_scale_factor (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_scale: (attributes org.gtk.Method.get_property=scale)
|
||||
* gdk_monitor_get_scale:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the internal scale factor that maps from monitor coordinates
|
||||
@@ -520,7 +520,7 @@ gdk_monitor_get_scale (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_refresh_rate: (attributes org.gtk.Method.get_property=refresh-rate)
|
||||
* gdk_monitor_get_refresh_rate:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the refresh rate of the monitor, if available.
|
||||
@@ -539,7 +539,7 @@ gdk_monitor_get_refresh_rate (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_subpixel_layout: (attributes org.gtk.Method.get_property=subpixel-layout)
|
||||
* gdk_monitor_get_subpixel_layout:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets information about the layout of red, green and blue
|
||||
@@ -649,7 +649,7 @@ void
|
||||
gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||
double scale)
|
||||
{
|
||||
g_return_if_fail (scale >= 1.);
|
||||
g_return_if_fail (scale > 0.);
|
||||
|
||||
monitor->scale_set = TRUE;
|
||||
|
||||
@@ -692,11 +692,11 @@ gdk_monitor_invalidate (GdkMonitor *monitor)
|
||||
{
|
||||
monitor->valid = FALSE;
|
||||
g_object_notify (G_OBJECT (monitor), "valid");
|
||||
g_signal_emit (monitor, signals[INVALIDATE], 0);
|
||||
g_signal_emit (monitor, gdk_monitor_signals[GDK_MONITOR_INVALIDATE], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_is_valid: (attributes org.gtk.Method.get_property=valid)
|
||||
* gdk_monitor_is_valid: (get-property valid)
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Returns %TRUE if the @monitor object corresponds to a
|
||||
@@ -716,7 +716,7 @@ gdk_monitor_is_valid (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_description: (attributes org.gtk.Method.get_property=description)
|
||||
* gdk_monitor_get_description:
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets a string describing the monitor, if available.
|
||||
@@ -741,7 +741,7 @@ gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
{
|
||||
g_free (monitor->description);
|
||||
monitor->description = g_strdup (description);
|
||||
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
||||
g_object_notify_by_pspec (G_OBJECT (monitor), gdk_monitor_properties[GDK_MONITOR_PROP_DESCRIPTION]);
|
||||
}
|
||||
|
||||
#define MM_PER_INCH 25.4
|
||||
|
||||
+8
-8
@@ -88,12 +88,12 @@ GdkPaintable * gtk_snapshot_free_to_paintable (GdkSnapshot
|
||||
G_DEFINE_INTERFACE (GdkPaintable, gdk_paintable, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
INVALIDATE_CONTENTS,
|
||||
INVALIDATE_SIZE,
|
||||
LAST_SIGNAL
|
||||
GDK_PAINTABLE_INVALIDATE_CONTENTS,
|
||||
GDK_PAINTABLE_INVALIDATE_SIZE,
|
||||
GDK_PAINTABLE_LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static guint gdk_paintable_signals[GDK_PAINTABLE_LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void
|
||||
gdk_paintable_default_snapshot (GdkPaintable *paintable,
|
||||
@@ -187,7 +187,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
|
||||
* Examples for such an event would be videos changing to the next frame or
|
||||
* the icon theme for an icon changing.
|
||||
*/
|
||||
signals[INVALIDATE_CONTENTS] =
|
||||
gdk_paintable_signals[GDK_PAINTABLE_INVALIDATE_CONTENTS] =
|
||||
g_signal_new (I_("invalidate-contents"),
|
||||
GDK_TYPE_PAINTABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -211,7 +211,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
|
||||
* Examples for such an event would be a paintable displaying
|
||||
* the contents of a toplevel surface being resized.
|
||||
*/
|
||||
signals[INVALIDATE_SIZE] =
|
||||
gdk_paintable_signals[GDK_PAINTABLE_INVALIDATE_SIZE] =
|
||||
g_signal_new (I_("invalidate-size"),
|
||||
GDK_TYPE_PAINTABLE,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -426,7 +426,7 @@ gdk_paintable_invalidate_contents (GdkPaintable *paintable)
|
||||
g_return_if_fail (GDK_IS_PAINTABLE (paintable));
|
||||
g_return_if_fail (!(gdk_paintable_get_flags (paintable) & GDK_PAINTABLE_STATIC_CONTENTS));
|
||||
|
||||
g_signal_emit (paintable, signals[INVALIDATE_CONTENTS], 0);
|
||||
g_signal_emit (paintable, gdk_paintable_signals[GDK_PAINTABLE_INVALIDATE_CONTENTS], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,7 +450,7 @@ gdk_paintable_invalidate_size (GdkPaintable *paintable)
|
||||
g_return_if_fail (GDK_IS_PAINTABLE (paintable));
|
||||
g_return_if_fail (!(gdk_paintable_get_flags (paintable) & GDK_PAINTABLE_STATIC_SIZE));
|
||||
|
||||
g_signal_emit (paintable, signals[INVALIDATE_SIZE], 0);
|
||||
g_signal_emit (paintable, gdk_paintable_signals[GDK_PAINTABLE_INVALIDATE_SIZE], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright © 2024 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 "gdkparalleltaskprivate.h"
|
||||
|
||||
typedef struct _TaskData TaskData;
|
||||
|
||||
struct _TaskData
|
||||
{
|
||||
GdkTaskFunc task_func;
|
||||
gpointer task_data;
|
||||
int n_running_tasks;
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_parallel_task_thread_func (gpointer data,
|
||||
gpointer unused)
|
||||
{
|
||||
TaskData *task = data;
|
||||
|
||||
task->task_func (task->task_data);
|
||||
|
||||
g_atomic_int_add (&task->n_running_tasks, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_parallel_task_run:
|
||||
* @task_func: the function to spawn
|
||||
* @task_data: data to pass to the function
|
||||
*
|
||||
* Spawns the given function in many threads.
|
||||
* Once all functions have exited, this function returns.
|
||||
**/
|
||||
void
|
||||
gdk_parallel_task_run (GdkTaskFunc task_func,
|
||||
gpointer task_data)
|
||||
{
|
||||
static GThreadPool *pool;
|
||||
TaskData task = {
|
||||
.task_func = task_func,
|
||||
.task_data = task_data,
|
||||
};
|
||||
int i, n_tasks;
|
||||
|
||||
if (g_once_init_enter (&pool))
|
||||
{
|
||||
GThreadPool *the_pool = g_thread_pool_new (gdk_parallel_task_thread_func,
|
||||
NULL,
|
||||
MAX (2, g_get_num_processors ()) - 1,
|
||||
FALSE,
|
||||
NULL);
|
||||
g_once_init_leave (&pool, the_pool);
|
||||
}
|
||||
|
||||
n_tasks = g_get_num_processors ();
|
||||
task.n_running_tasks = n_tasks;
|
||||
/* Start with 1 because we run 1 task ourselves */
|
||||
for (i = 1; i < n_tasks; i++)
|
||||
{
|
||||
g_thread_pool_push (pool, &task, NULL);
|
||||
}
|
||||
|
||||
gdk_parallel_task_thread_func (&task, NULL);
|
||||
|
||||
while (g_atomic_int_get (&task.n_running_tasks) > 0)
|
||||
g_thread_yield ();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright © 2024 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>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef void (* GdkTaskFunc) (gpointer user_data);
|
||||
|
||||
void gdk_parallel_task_run (GdkTaskFunc task_func,
|
||||
gpointer task_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+4
-4
@@ -80,7 +80,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
|
||||
iface->get_position_y = gdk_popup_default_get_position_y;
|
||||
|
||||
/**
|
||||
* GdkPopup:parent: (attributes org.gtk.Property.get=gdk_popup_get_parent)
|
||||
* GdkPopup:parent:
|
||||
*
|
||||
* The parent surface.
|
||||
*/
|
||||
@@ -90,7 +90,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkPopup:autohide: (attributes org.gtk.Property.get=gdk_popup_get_autohide)
|
||||
* GdkPopup:autohide:
|
||||
*
|
||||
* Whether to hide on outside clicks.
|
||||
*/
|
||||
@@ -178,7 +178,7 @@ gdk_popup_get_rect_anchor (GdkPopup *popup)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_popup_get_parent: (attributes org.gtk.Method.get_property=parent)
|
||||
* gdk_popup_get_parent:
|
||||
* @popup: a `GdkPopup`
|
||||
*
|
||||
* Returns the parent surface of a popup.
|
||||
@@ -233,7 +233,7 @@ gdk_popup_get_position_y (GdkPopup *popup)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_popup_get_autohide: (attributes org.gtk.Method.get_property=autohide)
|
||||
* gdk_popup_get_autohide:
|
||||
* @popup: a `GdkPopup`
|
||||
*
|
||||
* Returns whether this popup is set to hide on outside clicks.
|
||||
|
||||
@@ -52,6 +52,16 @@ gdk_rectangle_transform_affine (const GdkRectangle *src,
|
||||
dest->height = ceilf (MAX (y1, y2)) - dest->y;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gdk_rectangle_contains (const GdkRectangle *rect,
|
||||
const GdkRectangle *contained)
|
||||
{
|
||||
return contained->x >= rect->x
|
||||
&& contained->y >= rect->y
|
||||
&& contained->x + contained->width <= rect->x + rect->width
|
||||
&& contained->y + contained->height <= rect->y + rect->height;
|
||||
}
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+24
-24
@@ -42,21 +42,21 @@ struct _GdkSeatPrivate
|
||||
};
|
||||
|
||||
enum {
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED,
|
||||
TOOL_ADDED,
|
||||
TOOL_REMOVED,
|
||||
N_SIGNALS
|
||||
GDK_SEAT_DEVICE_ADDED,
|
||||
GDK_SEAT_DEVICE_REMOVED,
|
||||
GDK_SEAT_TOOL_ADDED,
|
||||
GDK_SEAT_TOOL_REMOVED,
|
||||
GDK_SEAT_N_SIGNALS
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
N_PROPS
|
||||
GDK_SEAT_PROP_0,
|
||||
GDK_SEAT_PROP_DISPLAY,
|
||||
GDK_SEAT_N_PROPS
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GParamSpec *props[N_PROPS] = { NULL };
|
||||
static guint gdk_seat_signals[GDK_SEAT_N_SIGNALS] = { 0 };
|
||||
static GParamSpec *gdk_seat_properties[GDK_SEAT_N_PROPS] = { NULL };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkSeat, gdk_seat, G_TYPE_OBJECT)
|
||||
|
||||
@@ -70,7 +70,7 @@ gdk_seat_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_SEAT_PROP_DISPLAY:
|
||||
priv->display = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
@@ -89,7 +89,7 @@ gdk_seat_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
case GDK_SEAT_PROP_DISPLAY:
|
||||
g_value_set_object (value, priv->display);
|
||||
break;
|
||||
default:
|
||||
@@ -113,7 +113,7 @@ gdk_seat_class_init (GdkSeatClass *klass)
|
||||
*
|
||||
* Emitted when a new input device is related to this seat.
|
||||
*/
|
||||
signals [DEVICE_ADDED] =
|
||||
gdk_seat_signals [GDK_SEAT_DEVICE_ADDED] =
|
||||
g_signal_new (g_intern_static_string ("device-added"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -130,7 +130,7 @@ gdk_seat_class_init (GdkSeatClass *klass)
|
||||
*
|
||||
* Emitted when an input device is removed (e.g. unplugged).
|
||||
*/
|
||||
signals [DEVICE_REMOVED] =
|
||||
gdk_seat_signals [GDK_SEAT_DEVICE_REMOVED] =
|
||||
g_signal_new (g_intern_static_string ("device-removed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -153,7 +153,7 @@ gdk_seat_class_init (GdkSeatClass *klass)
|
||||
*
|
||||
* A same tool may be used by several devices.
|
||||
*/
|
||||
signals [TOOL_ADDED] =
|
||||
gdk_seat_signals [GDK_SEAT_TOOL_ADDED] =
|
||||
g_signal_new (g_intern_static_string ("tool-added"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -169,7 +169,7 @@ gdk_seat_class_init (GdkSeatClass *klass)
|
||||
*
|
||||
* Emitted whenever a tool is no longer known to this @seat.
|
||||
*/
|
||||
signals [TOOL_REMOVED] =
|
||||
gdk_seat_signals [GDK_SEAT_TOOL_REMOVED] =
|
||||
g_signal_new (g_intern_static_string ("tool-removed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -179,18 +179,18 @@ gdk_seat_class_init (GdkSeatClass *klass)
|
||||
GDK_TYPE_DEVICE_TOOL);
|
||||
|
||||
/**
|
||||
* GdkSeat:display: (attributes org.gtk.Property.get=gdk_seat_get_display)
|
||||
* GdkSeat:display:
|
||||
*
|
||||
* `GdkDisplay` of this seat.
|
||||
*/
|
||||
props[PROP_DISPLAY] =
|
||||
gdk_seat_properties[GDK_SEAT_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
g_object_class_install_properties (object_class, GDK_SEAT_N_PROPS, gdk_seat_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -378,7 +378,7 @@ gdk_seat_device_added (GdkSeat *seat,
|
||||
GdkDevice *device)
|
||||
{
|
||||
gdk_device_set_seat (device, seat);
|
||||
g_signal_emit (seat, signals[DEVICE_ADDED], 0, device);
|
||||
g_signal_emit (seat, gdk_seat_signals[GDK_SEAT_DEVICE_ADDED], 0, device);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -386,11 +386,11 @@ gdk_seat_device_removed (GdkSeat *seat,
|
||||
GdkDevice *device)
|
||||
{
|
||||
gdk_device_set_seat (device, NULL);
|
||||
g_signal_emit (seat, signals[DEVICE_REMOVED], 0, device);
|
||||
g_signal_emit (seat, gdk_seat_signals[GDK_SEAT_DEVICE_REMOVED], 0, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_seat_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_seat_get_display:
|
||||
* @seat: a `GdkSeat`
|
||||
*
|
||||
* Returns the `GdkDisplay` this seat belongs to.
|
||||
@@ -412,14 +412,14 @@ void
|
||||
gdk_seat_tool_added (GdkSeat *seat,
|
||||
GdkDeviceTool *tool)
|
||||
{
|
||||
g_signal_emit (seat, signals[TOOL_ADDED], 0, tool);
|
||||
g_signal_emit (seat, gdk_seat_signals[GDK_SEAT_TOOL_ADDED], 0, tool);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_seat_tool_removed (GdkSeat *seat,
|
||||
GdkDeviceTool *tool)
|
||||
{
|
||||
g_signal_emit (seat, signals[TOOL_REMOVED], 0, tool);
|
||||
g_signal_emit (seat, gdk_seat_signals[GDK_SEAT_TOOL_REMOVED], 0, tool);
|
||||
}
|
||||
|
||||
GdkDeviceTool *
|
||||
|
||||
@@ -167,6 +167,12 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
/* if the texture fully covers the background, ignore it */
|
||||
if (background &&
|
||||
gsk_rect_contains_rect (dest, background) &&
|
||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) == GDK_MEMORY_ALPHA_OPAQUE)
|
||||
background = NULL;
|
||||
|
||||
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
|
||||
texture,
|
||||
source,
|
||||
|
||||
+208
-95
@@ -40,11 +40,13 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkmarshalers.h"
|
||||
#include "gdkpopupprivate.h"
|
||||
#include "gdkrectangle.h"
|
||||
#include "gdkrectangleprivate.h"
|
||||
#include "gdktoplevelprivate.h"
|
||||
#include "gdkvulkancontext.h"
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
|
||||
#include "gsk/gskrectprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
@@ -75,31 +77,34 @@ struct _GdkSurfacePrivate
|
||||
GdkMemoryDepth egl_surface_depth;
|
||||
#endif
|
||||
|
||||
cairo_region_t *opaque_region;
|
||||
cairo_rectangle_int_t opaque_rect; /* This is different from the region */
|
||||
|
||||
gpointer widget;
|
||||
|
||||
GdkColorState *color_state;
|
||||
};
|
||||
|
||||
enum {
|
||||
LAYOUT,
|
||||
RENDER,
|
||||
EVENT,
|
||||
ENTER_MONITOR,
|
||||
LEAVE_MONITOR,
|
||||
LAST_SIGNAL
|
||||
GDK_SURFACE_LAYOUT,
|
||||
GDK_SURFACE_RENDER,
|
||||
GDK_SURFACE_EVENT,
|
||||
GDK_SURFACE_ENTER_MONITOR,
|
||||
GDK_SURFACE_LEAVE_MONITOR,
|
||||
GDK_SURFACE_LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CURSOR,
|
||||
PROP_DISPLAY,
|
||||
PROP_FRAME_CLOCK,
|
||||
PROP_MAPPED,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_SCALE_FACTOR,
|
||||
PROP_SCALE,
|
||||
LAST_PROP
|
||||
GDK_SURFACE_PROP_0,
|
||||
GDK_SURFACE_PROP_CURSOR,
|
||||
GDK_SURFACE_PROP_DISPLAY,
|
||||
GDK_SURFACE_PROP_FRAME_CLOCK,
|
||||
GDK_SURFACE_PROP_MAPPED,
|
||||
GDK_SURFACE_PROP_WIDTH,
|
||||
GDK_SURFACE_PROP_HEIGHT,
|
||||
GDK_SURFACE_PROP_SCALE_FACTOR,
|
||||
GDK_SURFACE_PROP_SCALE,
|
||||
GDK_SURFACE_LAST_PROP
|
||||
};
|
||||
|
||||
/* Global info */
|
||||
@@ -115,15 +120,15 @@ static void gdk_surface_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void update_cursor (GdkDisplay *display,
|
||||
GdkDevice *device);
|
||||
static void gdk_surface_update_cursor (GdkDisplay *display,
|
||||
GdkDevice *device);
|
||||
|
||||
static void gdk_surface_queue_set_is_mapped (GdkSurface *surface,
|
||||
gboolean is_mapped);
|
||||
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||
static guint gdk_surface_signals[GDK_SURFACE_LAST_SIGNAL] = { 0 };
|
||||
static GParamSpec *gdk_surface_properties[GDK_SURFACE_LAST_PROP] = { NULL, };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
|
||||
|
||||
@@ -510,6 +515,12 @@ gdk_surface_real_create_subsurface (GdkSurface *surface)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_default_set_opaque_region (GdkSurface *surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_constructed (GObject *object)
|
||||
{
|
||||
@@ -533,93 +544,94 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
klass->beep = gdk_surface_real_beep;
|
||||
klass->get_scale = gdk_surface_real_get_scale;
|
||||
klass->create_subsurface = gdk_surface_real_create_subsurface;
|
||||
klass->set_opaque_region = gdk_surface_default_set_opaque_region;
|
||||
|
||||
/**
|
||||
* GdkSurface:cursor: (attributes org.gtk.Property.get=gdk_surface_get_cursor org.gtk.Property.set=gdk_surface_set_cursor)
|
||||
* GdkSurface:cursor:
|
||||
*
|
||||
* The mouse pointer for the `GdkSurface`.
|
||||
*/
|
||||
properties[PROP_CURSOR] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_CURSOR] =
|
||||
g_param_spec_object ("cursor", NULL, NULL,
|
||||
GDK_TYPE_CURSOR,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:display: (attributes org.gtk.Property.get=gdk_surface_get_display)
|
||||
* GdkSurface:display:
|
||||
*
|
||||
* The `GdkDisplay` connection of the surface.
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_DISPLAY] =
|
||||
g_param_spec_object ("display", NULL, NULL,
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:frame-clock: (attributes org.gtk.Property.get=gdk_surface_get_frame_clock)
|
||||
* GdkSurface:frame-clock:
|
||||
*
|
||||
* The `GdkFrameClock` of the surface.
|
||||
*/
|
||||
properties[PROP_FRAME_CLOCK] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_FRAME_CLOCK] =
|
||||
g_param_spec_object ("frame-clock", NULL, NULL,
|
||||
GDK_TYPE_FRAME_CLOCK,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:mapped: (attributes org.gtk.Property.get=gdk_surface_get_mapped)
|
||||
* GdkSurface:mapped:
|
||||
*
|
||||
* Whether the surface is mapped.
|
||||
*/
|
||||
properties[PROP_MAPPED] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_MAPPED] =
|
||||
g_param_spec_boolean ("mapped", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:width: (attributes org.gtk.Property.get=gdk_surface_get_width)
|
||||
* GdkSurface:width:
|
||||
*
|
||||
* The width of the surface in pixels.
|
||||
*/
|
||||
properties[PROP_WIDTH] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_WIDTH] =
|
||||
g_param_spec_int ("width", NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:height: (attributes org.gtk.Property.get=gdk_surface_get_height)
|
||||
* GdkSurface:height:
|
||||
*
|
||||
* The height of the surface, in pixels.
|
||||
*/
|
||||
properties[PROP_HEIGHT] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_HEIGHT] =
|
||||
g_param_spec_int ("height", NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:scale-factor: (attributes org.gtk.Property.get=gdk_surface_get_scale_factor)
|
||||
* GdkSurface:scale-factor:
|
||||
*
|
||||
* The scale factor of the surface.
|
||||
*
|
||||
* The scale factor is the next larger integer,
|
||||
* compared to [property@Gdk.Surface:scale].
|
||||
*/
|
||||
properties[PROP_SCALE_FACTOR] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_SCALE_FACTOR] =
|
||||
g_param_spec_int ("scale-factor", NULL, NULL,
|
||||
1, G_MAXINT, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkSurface:scale: (attributes org.gtk.Property.get=gdk_surface_get_scale)
|
||||
* GdkSurface:scale:
|
||||
*
|
||||
* The scale of the surface.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
properties[PROP_SCALE] =
|
||||
gdk_surface_properties[GDK_SURFACE_PROP_SCALE] =
|
||||
g_param_spec_double ("scale", NULL, NULL,
|
||||
1., G_MAXDOUBLE, 1.,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||
g_object_class_install_properties (object_class, GDK_SURFACE_LAST_PROP, gdk_surface_properties);
|
||||
|
||||
/**
|
||||
* GdkSurface::layout:
|
||||
@@ -633,7 +645,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
* Surface size is reported in ”application pixels”, not
|
||||
* ”device pixels” (see gdk_surface_get_scale_factor()).
|
||||
*/
|
||||
signals[LAYOUT] =
|
||||
gdk_surface_signals[GDK_SURFACE_LAYOUT] =
|
||||
g_signal_new (g_intern_static_string ("layout"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
@@ -645,7 +657,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
2,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
g_signal_set_va_marshaller (signals[LAYOUT],
|
||||
g_signal_set_va_marshaller (gdk_surface_signals[GDK_SURFACE_LAYOUT],
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
_gdk_marshal_VOID__INT_INTv);
|
||||
|
||||
@@ -658,7 +670,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
*
|
||||
* Returns: %TRUE to indicate that the signal has been handled
|
||||
*/
|
||||
signals[RENDER] =
|
||||
gdk_surface_signals[GDK_SURFACE_RENDER] =
|
||||
g_signal_new (g_intern_static_string ("render"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -669,7 +681,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
CAIRO_GOBJECT_TYPE_REGION);
|
||||
g_signal_set_va_marshaller (signals[RENDER],
|
||||
g_signal_set_va_marshaller (gdk_surface_signals[GDK_SURFACE_RENDER],
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
_gdk_marshal_BOOLEAN__BOXEDv);
|
||||
|
||||
@@ -682,7 +694,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
*
|
||||
* Returns: %TRUE to indicate that the event has been handled
|
||||
*/
|
||||
signals[EVENT] =
|
||||
gdk_surface_signals[GDK_SURFACE_EVENT] =
|
||||
g_signal_new (g_intern_static_string ("event"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -693,7 +705,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
g_signal_set_va_marshaller (signals[EVENT],
|
||||
g_signal_set_va_marshaller (gdk_surface_signals[GDK_SURFACE_EVENT],
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
gdk_surface_event_marshallerv);
|
||||
|
||||
@@ -704,7 +716,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
*
|
||||
* Emitted when @surface starts being present on the monitor.
|
||||
*/
|
||||
signals[ENTER_MONITOR] =
|
||||
gdk_surface_signals[GDK_SURFACE_ENTER_MONITOR] =
|
||||
g_signal_new (g_intern_static_string ("enter-monitor"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
@@ -723,7 +735,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
*
|
||||
* Emitted when @surface stops being present on the monitor.
|
||||
*/
|
||||
signals[LEAVE_MONITOR] =
|
||||
gdk_surface_signals[GDK_SURFACE_LEAVE_MONITOR] =
|
||||
g_signal_new (g_intern_static_string ("leave-monitor"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
@@ -771,7 +783,7 @@ gdk_surface_finalize (GObject *object)
|
||||
|
||||
g_clear_object (&surface->display);
|
||||
|
||||
g_clear_pointer (&surface->opaque_region, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
|
||||
|
||||
if (surface->parent)
|
||||
surface->parent->children = g_list_remove (surface->parent->children, surface);
|
||||
@@ -795,18 +807,18 @@ gdk_surface_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CURSOR:
|
||||
case GDK_SURFACE_PROP_CURSOR:
|
||||
gdk_surface_set_cursor (surface, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
case GDK_SURFACE_PROP_DISPLAY:
|
||||
surface->display = g_value_dup_object (value);
|
||||
g_assert (surface->display != NULL);
|
||||
g_signal_connect (surface->display, "seat-removed",
|
||||
G_CALLBACK (seat_removed_cb), surface);
|
||||
break;
|
||||
|
||||
case PROP_FRAME_CLOCK:
|
||||
case GDK_SURFACE_PROP_FRAME_CLOCK:
|
||||
gdk_surface_set_frame_clock (surface, GDK_FRAME_CLOCK (g_value_get_object (value)));
|
||||
break;
|
||||
|
||||
@@ -828,35 +840,35 @@ gdk_surface_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CURSOR:
|
||||
case GDK_SURFACE_PROP_CURSOR:
|
||||
g_value_set_object (value, gdk_surface_get_cursor (surface));
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
case GDK_SURFACE_PROP_DISPLAY:
|
||||
g_value_set_object (value, surface->display);
|
||||
break;
|
||||
|
||||
case PROP_FRAME_CLOCK:
|
||||
case GDK_SURFACE_PROP_FRAME_CLOCK:
|
||||
g_value_set_object (value, surface->frame_clock);
|
||||
break;
|
||||
|
||||
case PROP_MAPPED:
|
||||
case GDK_SURFACE_PROP_MAPPED:
|
||||
g_value_set_boolean (value, GDK_SURFACE_IS_MAPPED (surface));
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
case GDK_SURFACE_PROP_WIDTH:
|
||||
g_value_set_int (value, surface->width);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_SURFACE_PROP_HEIGHT:
|
||||
g_value_set_int (value, surface->height);
|
||||
break;
|
||||
|
||||
case PROP_SCALE_FACTOR:
|
||||
case GDK_SURFACE_PROP_SCALE_FACTOR:
|
||||
g_value_set_int (value, gdk_surface_get_scale_factor (surface));
|
||||
break;
|
||||
|
||||
case PROP_SCALE:
|
||||
case GDK_SURFACE_PROP_SCALE:
|
||||
g_value_set_double (value, gdk_surface_get_scale (surface));
|
||||
break;
|
||||
|
||||
@@ -1011,7 +1023,7 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
|
||||
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
g_object_notify (G_OBJECT (surface), "state");
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), gdk_surface_properties[GDK_SURFACE_PROP_MAPPED]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1071,7 +1083,7 @@ gdk_surface_get_widget (GdkSurface *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_surface_get_display:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Gets the `GdkDisplay` associated with a `GdkSurface`.
|
||||
@@ -1100,7 +1112,7 @@ gdk_surface_is_destroyed (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_mapped: (attributes org.gtk.Method.get_property=mapped)
|
||||
* gdk_surface_get_mapped:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Checks whether the surface has been mapped.
|
||||
@@ -1124,6 +1136,7 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
|
||||
GdkGLContext *current = NULL;
|
||||
|
||||
/* This checks that all EGL platforms we support conform to the same struct sizes.
|
||||
* When this ever fails, there will be some fun times happening for whoever tries
|
||||
@@ -1132,12 +1145,21 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
|
||||
|
||||
if (priv->egl_surface != NULL)
|
||||
{
|
||||
gdk_gl_context_clear_current_if_surface (self);
|
||||
eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (self);
|
||||
|
||||
current = gdk_gl_context_clear_current_if_surface (self);
|
||||
|
||||
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
|
||||
priv->egl_surface = NULL;
|
||||
}
|
||||
|
||||
priv->egl_native_window = native_window;
|
||||
|
||||
if (current)
|
||||
{
|
||||
gdk_gl_context_make_current (current);
|
||||
g_object_unref (current);
|
||||
}
|
||||
}
|
||||
|
||||
gpointer /* EGLSurface */
|
||||
@@ -1157,20 +1179,26 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
|
||||
|
||||
g_return_val_if_fail (priv->egl_native_window != NULL, depth);
|
||||
|
||||
if (priv->egl_surface_depth != depth &&
|
||||
priv->egl_surface != NULL &&
|
||||
gdk_display_get_egl_config (display, priv->egl_surface_depth) != gdk_display_get_egl_config (display, depth))
|
||||
if (depth == GDK_MEMORY_NONE)
|
||||
{
|
||||
gdk_gl_context_clear_current_if_surface (self);
|
||||
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
|
||||
priv->egl_surface = NULL;
|
||||
if (priv->egl_surface_depth == GDK_MEMORY_NONE)
|
||||
depth = GDK_MEMORY_U8;
|
||||
else
|
||||
depth = priv->egl_surface_depth;
|
||||
}
|
||||
|
||||
if (priv->egl_surface == NULL)
|
||||
if (priv->egl_surface == NULL ||
|
||||
(priv->egl_surface != NULL &&
|
||||
gdk_display_get_egl_config (display, priv->egl_surface_depth) != gdk_display_get_egl_config (display, depth)))
|
||||
{
|
||||
GdkGLContext *cleared;
|
||||
EGLint attribs[4];
|
||||
int i;
|
||||
|
||||
cleared = gdk_gl_context_clear_current_if_surface (self);
|
||||
if (priv->egl_surface != NULL)
|
||||
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
|
||||
|
||||
i = 0;
|
||||
if (depth == GDK_MEMORY_U8_SRGB && display->have_egl_gl_colorspace)
|
||||
{
|
||||
@@ -1195,6 +1223,12 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
|
||||
NULL);
|
||||
}
|
||||
priv->egl_surface_depth = depth;
|
||||
|
||||
if (cleared)
|
||||
{
|
||||
gdk_gl_context_make_current (cleared);
|
||||
g_object_unref (cleared);
|
||||
}
|
||||
}
|
||||
|
||||
return priv->egl_surface_depth;
|
||||
@@ -1254,7 +1288,7 @@ gdk_surface_create_gl_context (GdkSurface *surface,
|
||||
if (!gdk_display_prepare_gl (surface->display, error))
|
||||
return NULL;
|
||||
|
||||
return gdk_gl_context_new (surface->display, surface);
|
||||
return gdk_gl_context_new (surface->display, surface, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1352,7 +1386,7 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
|
||||
return;
|
||||
}
|
||||
|
||||
g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
|
||||
g_signal_emit (surface, gdk_surface_signals[GDK_SURFACE_LAYOUT], 0, surface->width, surface->height);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1405,7 +1439,7 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
|
||||
|
||||
g_object_ref (surface);
|
||||
|
||||
g_signal_emit (surface, signals[RENDER], 0, expose_region, &handled);
|
||||
g_signal_emit (surface, gdk_surface_signals[GDK_SURFACE_RENDER], 0, expose_region, &handled);
|
||||
|
||||
g_object_unref (surface);
|
||||
}
|
||||
@@ -1807,11 +1841,11 @@ gdk_surface_set_cursor_internal (GdkSurface *surface,
|
||||
pointer_info = _gdk_display_get_pointer_info (surface->display, device);
|
||||
|
||||
if (surface == pointer_info->surface_under_pointer)
|
||||
update_cursor (surface->display, device);
|
||||
gdk_surface_update_cursor (surface->display, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_cursor: (attributes org.gtk.Method.get_property=cursor)
|
||||
* gdk_surface_get_cursor:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Retrieves a `GdkCursor` pointer for the cursor currently set on the
|
||||
@@ -1833,7 +1867,7 @@ gdk_surface_get_cursor (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_set_cursor: (attributes org.gtk.Method.set_property=cursor)
|
||||
* gdk_surface_set_cursor:
|
||||
* @surface: a `GdkSurface`
|
||||
* @cursor: (nullable): a `GdkCursor`
|
||||
*
|
||||
@@ -1885,7 +1919,7 @@ gdk_surface_set_cursor (GdkSurface *surface,
|
||||
}
|
||||
|
||||
g_list_free (seats);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_CURSOR]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), gdk_surface_properties[GDK_SURFACE_PROP_CURSOR]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1993,7 +2027,7 @@ gdk_surface_get_geometry (GdkSurface *surface,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* gdk_surface_get_width:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Returns the width of the given @surface.
|
||||
@@ -2012,7 +2046,7 @@ gdk_surface_get_width (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* gdk_surface_get_height:
|
||||
* @surface: a `GdkSurface`
|
||||
*
|
||||
* Returns the height of the given @surface.
|
||||
@@ -2128,8 +2162,8 @@ gdk_surface_set_input_region (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
update_cursor (GdkDisplay *display,
|
||||
GdkDevice *device)
|
||||
gdk_surface_update_cursor (GdkDisplay *display,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GdkSurface *cursor_surface;
|
||||
GdkSurface *pointer_surface;
|
||||
@@ -2204,7 +2238,7 @@ _gdk_display_set_surface_under_pointer (GdkDisplay *display,
|
||||
if (surface)
|
||||
{
|
||||
g_object_ref (surface);
|
||||
update_cursor (display, device);
|
||||
gdk_surface_update_cursor (display, device);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2556,7 +2590,7 @@ gdk_surface_set_frame_clock (GdkSurface *surface,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_frame_clock: (attributes org.gtk.Method.get_property=frame-clock)
|
||||
* gdk_surface_get_frame_clock:
|
||||
* @surface: surface to get frame clock for
|
||||
*
|
||||
* Gets the frame clock for the surface.
|
||||
@@ -2575,7 +2609,7 @@ gdk_surface_get_frame_clock (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_scale_factor: (attributes org.gtk.Method.get_property=scale-factor)
|
||||
* gdk_surface_get_scale_factor:
|
||||
* @surface: surface to get scale factor for
|
||||
*
|
||||
* Returns the internal scale factor that maps from surface coordinates
|
||||
@@ -2601,7 +2635,7 @@ gdk_surface_get_scale_factor (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_scale: (attributes org.gtk.Method.get_property=scale)
|
||||
* gdk_surface_get_scale:
|
||||
* @surface: surface to get scale for
|
||||
*
|
||||
* Returns the internal scale that maps from surface coordinates
|
||||
@@ -2631,6 +2665,35 @@ gdk_surface_get_scale (GdkSurface *surface)
|
||||
return GDK_SURFACE_GET_CLASS (surface)->get_scale (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_update_opaque_region (GdkSurface *self)
|
||||
{
|
||||
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
|
||||
cairo_region_t *region;
|
||||
|
||||
if (priv->opaque_region == NULL)
|
||||
{
|
||||
if (priv->opaque_rect.width <= 0)
|
||||
region = NULL;
|
||||
else
|
||||
region = cairo_region_create_rectangle (&priv->opaque_rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->opaque_rect.width <= 0)
|
||||
region = cairo_region_reference (priv->opaque_region);
|
||||
else
|
||||
{
|
||||
region = cairo_region_copy (priv->opaque_region);
|
||||
cairo_region_union_rectangle (region, &priv->opaque_rect);
|
||||
}
|
||||
}
|
||||
|
||||
GDK_SURFACE_GET_CLASS (self)->set_opaque_region (self, region);
|
||||
|
||||
g_clear_pointer (®ion, cairo_region_destroy);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_set_opaque_region:
|
||||
* @surface: a top-level `GdkSurface`
|
||||
@@ -2652,27 +2715,77 @@ gdk_surface_get_scale (GdkSurface *surface)
|
||||
* is opaque, as we know where the opaque regions are. If your surface
|
||||
* background is not opaque, please update this property in your
|
||||
* [GtkWidgetClass.css_changed](../gtk4/vfunc.Widget.css_changed.html) handler.
|
||||
*
|
||||
* Deprecated: 4.16: GDK can figure out the opaque parts of a window itself
|
||||
* by inspecting the contents that are drawn.
|
||||
*/
|
||||
void
|
||||
gdk_surface_set_opaque_region (GdkSurface *surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkSurfaceClass *class;
|
||||
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (surface);
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
|
||||
|
||||
if (cairo_region_equal (surface->opaque_region, region))
|
||||
if (cairo_region_equal (priv->opaque_region, region))
|
||||
return;
|
||||
|
||||
g_clear_pointer (&surface->opaque_region, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
|
||||
|
||||
if (region != NULL)
|
||||
surface->opaque_region = cairo_region_reference (region);
|
||||
priv->opaque_region = cairo_region_reference (region);
|
||||
|
||||
class = GDK_SURFACE_GET_CLASS (surface);
|
||||
if (class->set_opaque_region)
|
||||
class->set_opaque_region (surface, region);
|
||||
gdk_surface_update_opaque_region (surface);
|
||||
}
|
||||
|
||||
/* Sets the opaque rect from the rendernode via end_frame() */
|
||||
void
|
||||
gdk_surface_set_opaque_rect (GdkSurface *self,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
|
||||
cairo_rectangle_int_t opaque;
|
||||
|
||||
if (rect)
|
||||
gsk_rect_to_cairo_shrink (rect, &opaque);
|
||||
else
|
||||
opaque = (cairo_rectangle_int_t) { 0, 0, 0, 0 };
|
||||
|
||||
if (gdk_rectangle_equal (&priv->opaque_rect, &opaque))
|
||||
return;
|
||||
|
||||
priv->opaque_rect = opaque;
|
||||
|
||||
gdk_surface_update_opaque_region (self);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdk_surface_is_opaque:
|
||||
* @self: a surface
|
||||
*
|
||||
* Checks if the whole surface is known to be opaque.
|
||||
* This allows using an RGBx buffer instead of RGBA.
|
||||
*
|
||||
* This function works for the currently rendered frame inside
|
||||
* begin_frame() implementations.
|
||||
*
|
||||
* Returns: %TRUE if the whole surface is provably opaque
|
||||
**/
|
||||
gboolean
|
||||
gdk_surface_is_opaque (GdkSurface *self)
|
||||
{
|
||||
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
|
||||
cairo_rectangle_int_t whole = { 0, 0, self->width, self->height };
|
||||
|
||||
if (gdk_rectangle_contains (&priv->opaque_rect, &whole))
|
||||
return TRUE;
|
||||
|
||||
if (priv->opaque_region &&
|
||||
cairo_region_contains_rectangle (priv->opaque_region, &whole) == CAIRO_REGION_OVERLAP_IN)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2967,7 +3080,7 @@ gdk_surface_handle_event (GdkEvent *event)
|
||||
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
|
||||
surface->request_motion = FALSE;
|
||||
|
||||
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
|
||||
g_signal_emit (surface, gdk_surface_signals[GDK_SURFACE_EVENT], 0, event, &handled);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
add_event_mark (event, begin_time, GDK_PROFILER_CURRENT_TIME);
|
||||
@@ -3076,14 +3189,14 @@ void
|
||||
gdk_surface_enter_monitor (GdkSurface *surface,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
g_signal_emit (surface, signals[ENTER_MONITOR], 0, monitor);
|
||||
g_signal_emit (surface, gdk_surface_signals[GDK_SURFACE_ENTER_MONITOR], 0, monitor);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_surface_leave_monitor (GdkSurface *surface,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
g_signal_emit (surface, signals[LEAVE_MONITOR], 0, monitor);
|
||||
g_signal_emit (surface, gdk_surface_signals[GDK_SURFACE_LEAVE_MONITOR], 0, monitor);
|
||||
}
|
||||
|
||||
GdkSubsurface *
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ void gdk_surface_request_layout (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkFrameClock* gdk_surface_get_frame_clock (GdkSurface *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_16
|
||||
void gdk_surface_set_opaque_region (GdkSurface *surface,
|
||||
cairo_region_t *region);
|
||||
|
||||
|
||||
+11
-10
@@ -96,8 +96,6 @@ struct _GdkSurface
|
||||
GSList *draw_contexts;
|
||||
GdkDrawContext *paint_context;
|
||||
|
||||
cairo_region_t *opaque_region;
|
||||
|
||||
GdkSeat *current_shortcuts_inhibited_seat;
|
||||
|
||||
GPtrArray *subsurfaces;
|
||||
@@ -253,14 +251,17 @@ gdk_gravity_flip_vertically (GdkGravity anchor)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
void _gdk_surface_destroy (GdkSurface *surface,
|
||||
gboolean foreign_destroy);
|
||||
void gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect);
|
||||
void gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
const cairo_region_t *region);
|
||||
void _gdk_surface_clear_update_area (GdkSurface *surface);
|
||||
void _gdk_surface_update_size (GdkSurface *surface);
|
||||
void _gdk_surface_destroy (GdkSurface *surface,
|
||||
gboolean foreign_destroy);
|
||||
void gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect);
|
||||
void gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
const cairo_region_t *region);
|
||||
void _gdk_surface_clear_update_area (GdkSurface *surface);
|
||||
void _gdk_surface_update_size (GdkSurface *surface);
|
||||
void gdk_surface_set_opaque_rect (GdkSurface *self,
|
||||
const graphene_rect_t *rect);
|
||||
gboolean gdk_surface_is_opaque (GdkSurface *self);
|
||||
|
||||
GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
|
||||
GError **error);
|
||||
|
||||
+34
-23
@@ -33,7 +33,18 @@
|
||||
*
|
||||
* `GdkTexture` is an immutable object: That means you cannot change
|
||||
* anything about it other than increasing the reference count via
|
||||
* [method@GObject.Object.ref], and consequently, it is a thread-safe object.
|
||||
* [method@GObject.Object.ref], and consequently, it is a threadsafe object.
|
||||
*
|
||||
* GDK provides a number of threadsafe texture loading functions:
|
||||
* [ctor@Gdk.Texture.new_from_resource],
|
||||
* [ctor@Gdk.Texture.new_from_bytes],
|
||||
* [ctor@Gdk.Texture.new_from_file],
|
||||
* [ctor@Gdk.Texture.new_from_filename],
|
||||
* [ctor@Gdk.Texture.new_for_pixbuf]. Note that these are meant for loading
|
||||
* icons and resources that are shipped with the toolkit or application. It
|
||||
* is recommended that you use a dedicated image loading framework such as
|
||||
* [glycin](https://lib.rs/crates/glycin), if you need to load untrusted image
|
||||
* data.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -69,15 +80,15 @@ gtk_snapshot_append_texture (GdkSnapshot *snapshot,
|
||||
const graphene_rect_t *bounds);
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_COLOR_STATE,
|
||||
GDK_TEXTURE_PROP_0,
|
||||
GDK_TEXTURE_PROP_WIDTH,
|
||||
GDK_TEXTURE_PROP_HEIGHT,
|
||||
GDK_TEXTURE_PROP_COLOR_STATE,
|
||||
|
||||
N_PROPS
|
||||
GDK_TEXTURE_N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPS];
|
||||
static GParamSpec *gdk_texture_properties[GDK_TEXTURE_N_PROPS];
|
||||
|
||||
static GdkTextureChain *
|
||||
gdk_texture_chain_new (void)
|
||||
@@ -279,15 +290,15 @@ gdk_texture_set_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WIDTH:
|
||||
case GDK_TEXTURE_PROP_WIDTH:
|
||||
self->width = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_TEXTURE_PROP_HEIGHT:
|
||||
self->height = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_TEXTURE_PROP_COLOR_STATE:
|
||||
self->color_state = g_value_dup_boxed (value);
|
||||
g_assert (self->color_state);
|
||||
break;
|
||||
@@ -308,15 +319,15 @@ gdk_texture_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WIDTH:
|
||||
case GDK_TEXTURE_PROP_WIDTH:
|
||||
g_value_set_int (value, self->width);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
case GDK_TEXTURE_PROP_HEIGHT:
|
||||
g_value_set_int (value, self->height);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
case GDK_TEXTURE_PROP_COLOR_STATE:
|
||||
g_value_set_boxed (value, self->color_state);
|
||||
break;
|
||||
|
||||
@@ -384,11 +395,11 @@ gdk_texture_class_init (GdkTextureClass *klass)
|
||||
gobject_class->finalize = gdk_texture_finalize;
|
||||
|
||||
/**
|
||||
* GdkTexture:width: (attributes org.gtk.Property.get=gdk_texture_get_width)
|
||||
* GdkTexture:width:
|
||||
*
|
||||
* The width of the texture, in pixels.
|
||||
*/
|
||||
properties[PROP_WIDTH] =
|
||||
gdk_texture_properties[GDK_TEXTURE_PROP_WIDTH] =
|
||||
g_param_spec_int ("width", NULL, NULL,
|
||||
1,
|
||||
G_MAXINT,
|
||||
@@ -399,11 +410,11 @@ gdk_texture_class_init (GdkTextureClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkTexture:height: (attributes org.gtk.Property.get=gdk_texture_get_height)
|
||||
* GdkTexture:height:
|
||||
*
|
||||
* The height of the texture, in pixels.
|
||||
*/
|
||||
properties[PROP_HEIGHT] =
|
||||
gdk_texture_properties[GDK_TEXTURE_PROP_HEIGHT] =
|
||||
g_param_spec_int ("height", NULL, NULL,
|
||||
1,
|
||||
G_MAXINT,
|
||||
@@ -414,13 +425,13 @@ gdk_texture_class_init (GdkTextureClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkTexture:color-state: (attributes org.gtk.Property.get=gdk_texture_get_color_state)
|
||||
* GdkTexture:color-state:
|
||||
*
|
||||
* The color state of the texture.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_STATE] =
|
||||
gdk_texture_properties[GDK_TEXTURE_PROP_COLOR_STATE] =
|
||||
g_param_spec_boxed ("color-state", NULL, NULL,
|
||||
GDK_TYPE_COLOR_STATE,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -428,7 +439,7 @@ gdk_texture_class_init (GdkTextureClass *klass)
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
g_object_class_install_properties (gobject_class, GDK_TEXTURE_N_PROPS, gdk_texture_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -770,7 +781,7 @@ gdk_texture_new_from_filename (const char *path,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* gdk_texture_get_width:
|
||||
* @texture: a `GdkTexture`
|
||||
*
|
||||
* Returns the width of @texture, in pixels.
|
||||
@@ -786,7 +797,7 @@ gdk_texture_get_width (GdkTexture *texture)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* gdk_texture_get_height:
|
||||
* @texture: a `GdkTexture`
|
||||
*
|
||||
* Returns the height of the @texture, in pixels.
|
||||
@@ -802,7 +813,7 @@ gdk_texture_get_height (GdkTexture *texture)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_get_color_state: (attributes org.gtk.Method.get_property=color-state)
|
||||
* gdk_texture_get_color_state:
|
||||
* @self: a `GdkTexture`
|
||||
*
|
||||
* Returns the color state associated with the texture.
|
||||
|
||||
+21
-21
@@ -43,12 +43,12 @@ G_DEFINE_INTERFACE (GdkToplevel, gdk_toplevel, GDK_TYPE_SURFACE)
|
||||
|
||||
enum
|
||||
{
|
||||
COMPUTE_SIZE,
|
||||
GDK_TOPLEVEL_COMPUTE_SIZE,
|
||||
|
||||
N_SIGNALS
|
||||
GDK_TOPLEVEL_N_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static guint gdk_toplevel_signals[GDK_TOPLEVEL_N_SIGNALS] = { 0 };
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_present (GdkToplevel *toplevel,
|
||||
@@ -109,7 +109,7 @@ void
|
||||
gdk_toplevel_notify_compute_size (GdkToplevel *toplevel,
|
||||
GdkToplevelSize *size)
|
||||
{
|
||||
g_signal_emit (toplevel, signals[COMPUTE_SIZE], 0, size);
|
||||
g_signal_emit (toplevel, gdk_toplevel_signals[GDK_TOPLEVEL_COMPUTE_SIZE], 0, size);
|
||||
gdk_toplevel_size_validate (size);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
iface->unexport_handle = gdk_toplevel_default_unexport_handle;
|
||||
|
||||
/**
|
||||
* GdkToplevel:state: (attributes org.gtk.Property.get=gdk_toplevel_get_state)
|
||||
* GdkToplevel:state:
|
||||
*
|
||||
* The state of the toplevel.
|
||||
*/
|
||||
@@ -167,7 +167,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkToplevel:title: (attributes org.gtk.Property.set=gdk_toplevel_set_title)
|
||||
* GdkToplevel:title:
|
||||
*
|
||||
* The title of the surface.
|
||||
*/
|
||||
@@ -177,7 +177,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GdkToplevel:startup-id: (attributes org.gtk.Property.set=gdk_toplevel_set_startup_id)
|
||||
* GdkToplevel:startup-id:
|
||||
*
|
||||
* The startup ID of the surface.
|
||||
*
|
||||
@@ -190,7 +190,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GdkToplevel:transient-for: (attributes org.gtk.Property.set=gdk_toplevel_set_transient_for)
|
||||
* GdkToplevel:transient-for:
|
||||
*
|
||||
* The transient parent of the surface.
|
||||
*/
|
||||
@@ -200,7 +200,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GdkToplevel:modal: (attributes org.gtk.Property.set=gdk_toplevel_set_modal)
|
||||
* GdkToplevel:modal:
|
||||
*
|
||||
* Whether the surface is modal.
|
||||
*/
|
||||
@@ -210,7 +210,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GdkToplevel:icon-list: (attributes org.gtk.Property.set=gdk_toplevel_set_icon_list)
|
||||
* GdkToplevel:icon-list:
|
||||
*
|
||||
* A list of textures to use as icon.
|
||||
*/
|
||||
@@ -219,7 +219,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GdkToplevel:decorated: (attributes org.gtk.Property.set=gdk_toplevel_set_decorated)
|
||||
* GdkToplevel:decorated:
|
||||
*
|
||||
* Whether the window manager should add decorations.
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GdkToplevel:deletable: (attributes org.gtk.Property.set=gdk_toplevel_set_deletable)
|
||||
* GdkToplevel:deletable:
|
||||
*
|
||||
* Whether the window manager should allow to close the surface.
|
||||
*/
|
||||
@@ -278,7 +278,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
* passed via the [struct@Gdk.ToplevelSize] object. Failing to do so
|
||||
* will result in an arbitrary size being used as a result.
|
||||
*/
|
||||
signals[COMPUTE_SIZE] =
|
||||
gdk_toplevel_signals[GDK_TOPLEVEL_COMPUTE_SIZE] =
|
||||
g_signal_new (I_("compute-size"),
|
||||
GDK_TYPE_TOPLEVEL,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -391,7 +391,7 @@ gdk_toplevel_focus (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_get_state: (attributes org.gtk.Method.get_property=state)
|
||||
* gdk_toplevel_get_state:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
*
|
||||
* Gets the bitwise or of the currently active surface state flags,
|
||||
@@ -412,7 +412,7 @@ gdk_toplevel_get_state (GdkToplevel *toplevel)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_title: (attributes org.gtk.Method.set_property=title)
|
||||
* gdk_toplevel_set_title:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @title: title of @surface
|
||||
*
|
||||
@@ -431,7 +431,7 @@ gdk_toplevel_set_title (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_startup_id: (attributes org.gtk.Method.set_property=startup-id)
|
||||
* gdk_toplevel_set_startup_id:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @startup_id: a string with startup-notification identifier
|
||||
*
|
||||
@@ -451,7 +451,7 @@ gdk_toplevel_set_startup_id (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_transient_for: (attributes org.gtk.Method.set_property=transient-for)
|
||||
* gdk_toplevel_set_transient_for:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @parent: another toplevel `GdkSurface`
|
||||
*
|
||||
@@ -475,7 +475,7 @@ gdk_toplevel_set_transient_for (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_modal: (attributes org.gtk.Method.set_property=modal)
|
||||
* gdk_toplevel_set_modal:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @modal: %TRUE if the surface is modal, %FALSE otherwise.
|
||||
*
|
||||
@@ -499,7 +499,7 @@ gdk_toplevel_set_modal (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_icon_list: (attributes org.gtk.Method.set_property=icon-list)
|
||||
* gdk_toplevel_set_icon_list:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @surfaces: (transfer none) (element-type GdkTexture):
|
||||
* A list of textures to use as icon, of different sizes
|
||||
@@ -547,7 +547,7 @@ gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_decorated: (attributes org.gtk.Method.set_property=decorated)
|
||||
* gdk_toplevel_set_decorated:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @decorated: %TRUE to request decorations
|
||||
*
|
||||
@@ -567,7 +567,7 @@ gdk_toplevel_set_decorated (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_set_deletable: (attributes org.gtk.Method.set_property=deletable)
|
||||
* gdk_toplevel_set_deletable:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @deletable: %TRUE to request a delete button
|
||||
*
|
||||
|
||||
+8
-1
@@ -85,7 +85,6 @@ typedef enum
|
||||
* @GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE: whether the bottom edge is resizable
|
||||
* @GDK_TOPLEVEL_STATE_LEFT_TILED: whether the left edge is tiled
|
||||
* @GDK_TOPLEVEL_STATE_LEFT_RESIZABLE: whether the left edge is resizable
|
||||
* @GDK_TOPLEVEL_STATE_SUSPENDED: the surface is not visible to the user
|
||||
*
|
||||
* Specifies the state of a toplevel surface.
|
||||
*
|
||||
@@ -95,6 +94,14 @@ typedef enum
|
||||
* will give an indication of tiledness without any of the per-edge states
|
||||
* being set.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GDK_TOPLEVEL_STATE_SUSPENDED:
|
||||
*
|
||||
* The surface is not visible to the user.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 0,
|
||||
|
||||
+71
-38
@@ -41,6 +41,7 @@ static const GdkDebugKey gsk_vulkan_feature_keys[] = {
|
||||
{ "semaphore-export", GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT, "Disable sync of exported dmabufs" },
|
||||
{ "semaphore-import", GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT, "Disable sync of imported dmabufs" },
|
||||
{ "incremental-present", GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT, "Do not send damage regions" },
|
||||
{ "swapchain-maintenance", GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE, "Do not use advanced swapchain features" },
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -87,9 +88,9 @@ struct _GdkVulkanContextPrivate {
|
||||
};
|
||||
|
||||
enum {
|
||||
IMAGES_UPDATED,
|
||||
GDK_VULKAN_CONTEXT_IMAGES_UPDATED,
|
||||
|
||||
LAST_SIGNAL
|
||||
GDK_VULKAN_CONTEXT_LAST_SIGNAL
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -101,7 +102,7 @@ enum {
|
||||
**/
|
||||
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static guint gdk_vulkan_context_signals[GDK_VULKAN_CONTEXT_LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gdk_vulkan_context_initable_init (GInitableIface *iface);
|
||||
|
||||
@@ -303,6 +304,15 @@ surface_present_mode_to_string (VkPresentModeKHR present_mode)
|
||||
return "(unknown)";
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_vulkan_context_has_feature (GdkVulkanContext *self,
|
||||
GdkVulkanFeatures feature)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (self));
|
||||
|
||||
return (display->vulkan_features & feature) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static const VkPresentModeKHR preferred_present_modes[] = {
|
||||
VK_PRESENT_MODE_MAILBOX_KHR,
|
||||
VK_PRESENT_MODE_IMMEDIATE_KHR,
|
||||
@@ -457,8 +467,9 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
|
||||
&(VkSwapchainCreateInfoKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.flags =
|
||||
(gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE) ?
|
||||
VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT : 0),
|
||||
.surface = priv->surface,
|
||||
.minImageCount = CLAMP (4,
|
||||
capabilities.minImageCount,
|
||||
@@ -527,7 +538,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_emit (context, signals[IMAGES_UPDATED], 0);
|
||||
g_signal_emit (context, gdk_vulkan_context_signals[GDK_VULKAN_CONTEXT_IMAGES_UPDATED], 0);
|
||||
|
||||
return res == VK_SUCCESS;
|
||||
}
|
||||
@@ -556,8 +567,12 @@ physical_device_supports_extension (VkPhysicalDevice device,
|
||||
static GdkVulkanFeatures
|
||||
physical_device_check_features (VkPhysicalDevice device)
|
||||
{
|
||||
VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT swapchain_maintenance1_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT,
|
||||
};
|
||||
VkPhysicalDeviceVulkan12Features v12_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
|
||||
.pNext = &swapchain_maintenance1_features
|
||||
};
|
||||
VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcr_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
|
||||
@@ -603,6 +618,10 @@ physical_device_check_features (VkPhysicalDevice device)
|
||||
if (physical_device_supports_extension (device, VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
|
||||
|
||||
if (swapchain_maintenance1_features.swapchainMaintenance1 ||
|
||||
physical_device_supports_extension (device, VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE;
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
@@ -692,11 +711,10 @@ gdk_vulkan_context_end_frame (GdkDrawContext *draw_context,
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkDisplay *display = gdk_draw_context_get_display (draw_context);
|
||||
VkRectLayerKHR *rectangles;
|
||||
int n_regions;
|
||||
|
||||
if (display->vulkan_features & GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT)
|
||||
if (gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT))
|
||||
{
|
||||
double scale;
|
||||
|
||||
@@ -714,8 +732,8 @@ gdk_vulkan_context_end_frame (GdkDrawContext *draw_context,
|
||||
.layer = 0,
|
||||
.offset.x = (int) floor (r.x * scale),
|
||||
.offset.y = (int) floor (r.y * scale),
|
||||
.extent.width = (int) ceil (r.width * scale),
|
||||
.extent.height = (int) ceil (r.height * scale),
|
||||
.extent.width = (int) ceil ((r.x + r.width) * scale) - floor (r.x * scale),
|
||||
.extent.height = (int) ceil ((r.y + r.height) * scale) - floor (r.y * scale),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -786,7 +804,7 @@ gdk_vulkan_context_class_init (GdkVulkanContextClass *klass)
|
||||
* Usually this means that the swapchain had to be recreated,
|
||||
* for example in response to a change of the surface size.
|
||||
*/
|
||||
signals[IMAGES_UPDATED] =
|
||||
gdk_vulkan_context_signals[GDK_VULKAN_CONTEXT_IMAGES_UPDATED] =
|
||||
g_signal_new (g_intern_static_string ("images-updated"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@@ -1348,7 +1366,6 @@ gdk_vulkan_context_get_draw_index (GdkVulkanContext *context)
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), 0);
|
||||
g_return_val_if_fail (gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)), 0);
|
||||
|
||||
return priv->draw_index;
|
||||
}
|
||||
@@ -1372,7 +1389,6 @@ gdk_vulkan_context_set_draw_semaphore (GdkVulkanContext *context,
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_if_fail (GDK_IS_VULKAN_CONTEXT (context));
|
||||
g_return_if_fail (!gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)));
|
||||
g_return_if_fail (priv->draw_semaphore == VK_NULL_HANDLE);
|
||||
|
||||
priv->draw_semaphore = semaphore;
|
||||
@@ -1408,8 +1424,9 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
last = n_devices;
|
||||
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
"GDK_VULKAN_DISABLE can be set to a list of Vulkan features to disable.\n",
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
if (skip_features & GDK_VULKAN_FEATURE_YCBCR)
|
||||
skip_features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
@@ -1508,6 +1525,11 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
{
|
||||
if (queue_props[j].queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||
{
|
||||
VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT swapchain_maintenance1_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT,
|
||||
.swapchainMaintenance1 = VK_TRUE,
|
||||
};
|
||||
gpointer create_device_pNext = NULL;
|
||||
GPtrArray *device_extensions;
|
||||
|
||||
device_extensions = g_ptr_array_new ();
|
||||
@@ -1536,6 +1558,12 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
}
|
||||
if (features & GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT)
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE)
|
||||
{
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME);
|
||||
swapchain_maintenance1_features.pNext = create_device_pNext;
|
||||
create_device_pNext = &swapchain_maintenance1_features;
|
||||
}
|
||||
|
||||
#define ENABLE_IF(flag) ((features & (flag)) ? VK_TRUE : VK_FALSE)
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Using Vulkan device %u, queue %u", i, j);
|
||||
@@ -1554,6 +1582,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
.pNext = &(VkPhysicalDeviceVulkan11Features) {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES,
|
||||
.samplerYcbcrConversion = ENABLE_IF (GDK_VULKAN_FEATURE_YCBCR),
|
||||
.pNext = create_device_pNext,
|
||||
}
|
||||
},
|
||||
NULL,
|
||||
@@ -1628,10 +1657,10 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
gboolean have_debug_report = FALSE;
|
||||
VkResult res;
|
||||
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_DISABLE)
|
||||
if (!gdk_has_feature (GDK_FEATURE_VULKAN))
|
||||
{
|
||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
_("Vulkan support disabled via GDK_DEBUG"));
|
||||
_("Vulkan support disabled via GDK_DISABLE"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1672,28 +1701,32 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
res = GDK_VK_CHECK (vkCreateInstance, &(VkInstanceCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.pApplicationInfo = &(VkApplicationInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
.pNext = NULL,
|
||||
.pApplicationName = g_get_application_name (),
|
||||
.applicationVersion = 0,
|
||||
.pEngineName = "GTK",
|
||||
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
||||
.apiVersion = VK_API_VERSION_1_3
|
||||
},
|
||||
.enabledLayerCount = 0,
|
||||
.ppEnabledLayerNames = NULL,
|
||||
.enabledExtensionCount = used_extensions->len,
|
||||
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
|
||||
},
|
||||
NULL,
|
||||
&display->vk_instance);
|
||||
res = vkCreateInstance (&(VkInstanceCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.pApplicationInfo = &(VkApplicationInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
.pNext = NULL,
|
||||
.pApplicationName = g_get_application_name (),
|
||||
.applicationVersion = 0,
|
||||
.pEngineName = "GTK",
|
||||
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
||||
.apiVersion = VK_API_VERSION_1_3
|
||||
},
|
||||
.enabledLayerCount = 0,
|
||||
.ppEnabledLayerNames = NULL,
|
||||
.enabledExtensionCount = used_extensions->len,
|
||||
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
|
||||
},
|
||||
NULL,
|
||||
&display->vk_instance);
|
||||
g_ptr_array_free (used_extensions, TRUE);
|
||||
|
||||
if (res != VK_SUCCESS)
|
||||
@@ -1992,7 +2025,7 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
static void
|
||||
gdk_vulkan_context_class_init (GdkVulkanContextClass *klass)
|
||||
{
|
||||
signals[IMAGES_UPDATED] =
|
||||
gdk_vulkan_context_signals[GDK_VULKAN_CONTEXT_IMAGES_UPDATED] =
|
||||
g_signal_new (g_intern_static_string ("images-updated"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
|
||||
@@ -65,7 +65,7 @@ gdk_vulkan_handle_result (VkResult res,
|
||||
{
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
GDK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
|
||||
g_warning ("%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -1133,6 +1133,7 @@
|
||||
0x00fe8a dead_small_schwa
|
||||
0x00fe8b dead_capital_schwa
|
||||
0x00fe8c dead_greek
|
||||
0x00fe8d dead_hamza
|
||||
0x00fea0 ch
|
||||
0x00fea1 Ch
|
||||
0x00fea2 CH
|
||||
@@ -1398,6 +1399,11 @@
|
||||
0x1000259 schwa
|
||||
0x1000275 obarred
|
||||
0x1000292 ezh
|
||||
0x1000300 combining_grave
|
||||
0x1000301 combining_acute
|
||||
0x1000303 combining_tilde
|
||||
0x1000309 combining_hook
|
||||
0x1000323 combining_belowdot
|
||||
0x1000492 Cyrillic_GHE_bar
|
||||
0x1000493 Cyrillic_ghe_bar
|
||||
0x1000496 Cyrillic_ZHE_descender
|
||||
|
||||
+2293
-2275
File diff suppressed because it is too large
Load Diff
+17
-17
@@ -228,7 +228,7 @@ struct _FormatData {
|
||||
guint16 bits_per_sample;
|
||||
guint16 samples_per_pixel;
|
||||
guint16 sample_format;
|
||||
guint16 alpha_samples;
|
||||
gint16 alpha_samples;
|
||||
guint16 photometric;
|
||||
};
|
||||
|
||||
@@ -241,27 +241,27 @@ static const FormatData format_data[] = {
|
||||
[GDK_MEMORY_A8R8G8B8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_A8B8G8R8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8X8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_X8R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_B8G8R8X8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_X8B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, -1, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, -1, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R8G8B8X8] = { GDK_MEMORY_R8G8B8X8, 8, 4, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_X8R8G8B8] = { GDK_MEMORY_R8G8B8X8, 8, 4, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_B8G8R8X8] = { GDK_MEMORY_R8G8B8X8, 8, 4, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_X8B8G8R8] = { GDK_MEMORY_R8G8B8X8, 8, 4, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, -1, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16] = { GDK_MEMORY_R16G16B16A16, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = { GDK_MEMORY_R16G16B16_FLOAT, 16, 3, SAMPLEFORMAT_IEEEFP, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = { GDK_MEMORY_R16G16B16_FLOAT, 16, 3, SAMPLEFORMAT_IEEEFP, -1, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = { GDK_MEMORY_R16G16B16A16_FLOAT, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = { GDK_MEMORY_R32G32B32_FLOAT, 32, 3, SAMPLEFORMAT_IEEEFP, 0, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = { GDK_MEMORY_R32G32B32_FLOAT, 32, 3, SAMPLEFORMAT_IEEEFP, -1, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = { GDK_MEMORY_R32G32B32A32_FLOAT, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||
[GDK_MEMORY_G8A8_PREMULTIPLIED] = { GDK_MEMORY_G8A8_PREMULTIPLIED, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G8A8] = { GDK_MEMORY_G8A8, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G8] = { GDK_MEMORY_G8, 8, 1, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G8] = { GDK_MEMORY_G8, 8, 1, SAMPLEFORMAT_UINT, -1, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16A16_PREMULTIPLIED] = { GDK_MEMORY_G16A16_PREMULTIPLIED, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16A16] = { GDK_MEMORY_G16A16, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16] = { GDK_MEMORY_G16, 16, 1, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_G16] = { GDK_MEMORY_G16, 16, 1, SAMPLEFORMAT_UINT, -1, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_A8] = { GDK_MEMORY_G8A8, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_A16] = { GDK_MEMORY_G16A16, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||
[GDK_MEMORY_A16_FLOAT] = { GDK_MEMORY_R16G16B16A16_FLOAT, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||
@@ -302,7 +302,7 @@ gdk_save_tiff (GdkTexture *texture)
|
||||
TIFFSetField (tif, TIFFTAG_SAMPLEFORMAT, fdata->sample_format);
|
||||
TIFFSetField (tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||
TIFFSetField (tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
|
||||
if (fdata->alpha_samples)
|
||||
if (fdata->alpha_samples >= 0)
|
||||
TIFFSetField (tif, TIFFTAG_EXTRASAMPLES, 1, &fdata->alpha_samples);
|
||||
|
||||
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, fdata->photometric);
|
||||
@@ -384,7 +384,7 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
guint16 sample_format;
|
||||
guint16 orientation;
|
||||
guint32 width, height;
|
||||
guint16 alpha_samples;
|
||||
gint16 alpha_samples;
|
||||
GdkMemoryFormat format;
|
||||
guchar *data, *line;
|
||||
gsize stride;
|
||||
@@ -421,9 +421,9 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
if (TIFFGetField (tif, TIFFTAG_EXTRASAMPLES, &extra, &extra_types))
|
||||
alpha_samples = extra_types[0];
|
||||
else
|
||||
alpha_samples = 0;
|
||||
alpha_samples = -1;
|
||||
|
||||
if (alpha_samples != 0 && alpha_samples != EXTRASAMPLE_ASSOCALPHA && alpha_samples != EXTRASAMPLE_UNASSALPHA)
|
||||
if (alpha_samples >= 0 && alpha_samples != EXTRASAMPLE_ASSOCALPHA && alpha_samples != EXTRASAMPLE_UNASSALPHA && alpha_samples != 0)
|
||||
{
|
||||
texture = load_fallback (tif, error);
|
||||
TIFFClose (tif);
|
||||
@@ -431,7 +431,7 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
}
|
||||
}
|
||||
else
|
||||
alpha_samples = 0;
|
||||
alpha_samples = -1;
|
||||
|
||||
for (format = 0; format < G_N_ELEMENTS (format_data); format++)
|
||||
{
|
||||
|
||||
+10
-19
@@ -250,8 +250,7 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return GDK_IS_TOPLEVEL (gdk_surface) ||
|
||||
(GDK_IS_POPUP (gdk_surface) && GDK_SURFACE (gdk_surface)->input_region != NULL);
|
||||
return GDK_IS_TOPLEVEL (gdk_surface);
|
||||
}
|
||||
|
||||
-(void)showAndMakeKey:(BOOL)makeKey
|
||||
@@ -692,24 +691,9 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)setStyleMask:(NSWindowStyleMask)styleMask
|
||||
{
|
||||
gboolean was_opaque;
|
||||
gboolean is_opaque;
|
||||
|
||||
was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
[super setStyleMask:styleMask];
|
||||
|
||||
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
|
||||
if (was_opaque != is_opaque)
|
||||
{
|
||||
[self setOpaque:is_opaque];
|
||||
|
||||
if (!is_opaque)
|
||||
[self setBackgroundColor:[NSColor clearColor]];
|
||||
}
|
||||
}
|
||||
|
||||
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
|
||||
@@ -785,13 +769,20 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
if (decorated)
|
||||
{
|
||||
style_mask |= NSWindowStyleMaskTitled;
|
||||
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleVisible];
|
||||
}
|
||||
else
|
||||
{
|
||||
style_mask &= ~NSWindowStyleMaskTitled;
|
||||
style_mask |= NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
|
||||
[self setTitlebarAppearsTransparent:!decorated];
|
||||
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
|
||||
|
||||
[self setStyleMask:style_mask];
|
||||
}
|
||||
|
||||
|
||||
@@ -107,32 +107,13 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
|
||||
cairo_clip (cr);
|
||||
}
|
||||
|
||||
/* If we have some exposed transparent area in the damage region,
|
||||
* we need to clear the existing content first to leave an transparent
|
||||
* area for cairo. We use (surface_bounds or damage)-(opaque) to get
|
||||
* the smallest set of rectangles we need to clear as it's expensive.
|
||||
*/
|
||||
if (!opaque)
|
||||
{
|
||||
cairo_region_t *transparent;
|
||||
cairo_rectangle_int_t r = { 0, 0, width/scale, height/scale };
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
if (damage != NULL)
|
||||
cairo_region_get_extents (damage, &r);
|
||||
transparent = cairo_region_create_rectangle (&r);
|
||||
if (surface->opaque_region)
|
||||
cairo_region_subtract (transparent, surface->opaque_region);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
|
||||
if (!cairo_region_is_empty (transparent))
|
||||
{
|
||||
gdk_cairo_region (cr, transparent);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
cairo_region_destroy (transparent);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ gdk_macos_gl_context_allocate (GdkMacosGLContext *self)
|
||||
return;
|
||||
|
||||
/* Alter to an opaque surface if necessary */
|
||||
opaque = _gdk_macos_surface_is_opaque (GDK_MACOS_SURFACE (surface));
|
||||
opaque = gdk_surface_is_opaque (surface);
|
||||
if (opaque != self->last_opaque)
|
||||
{
|
||||
self->last_opaque = !!opaque;
|
||||
|
||||
@@ -86,7 +86,6 @@ CGDirectDisplayID _gdk_macos_surface_get_screen_id (GdkMacosSurface
|
||||
const char *_gdk_macos_surface_get_title (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_set_title (GdkMacosSurface *self,
|
||||
const char *title);
|
||||
gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self);
|
||||
NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self);
|
||||
gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_set_modal_hint (GdkMacosSurface *self,
|
||||
|
||||
@@ -533,7 +533,7 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
|
||||
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
|
||||
|
||||
/**
|
||||
* GdkMacosSurface:native: (attributes org.gtk.Property.get=gdk_macos_surface_get_native_window)
|
||||
* GdkMacosSurface:native:
|
||||
*
|
||||
* The "native" property contains the underlying NSWindow.
|
||||
*/
|
||||
@@ -553,29 +553,6 @@ gdk_macos_surface_init (GdkMacosSurface *self)
|
||||
self->monitors = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_macos_surface_is_opaque (GdkMacosSurface *self)
|
||||
{
|
||||
GdkSurface *surface = (GdkSurface *)self;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), FALSE);
|
||||
|
||||
if (surface->opaque_region != NULL &&
|
||||
cairo_region_num_rectangles (surface->opaque_region) == 1)
|
||||
{
|
||||
cairo_rectangle_int_t extents;
|
||||
|
||||
cairo_region_get_extents (surface->opaque_region, &extents);
|
||||
|
||||
return (extents.x == 0 &&
|
||||
extents.y == 0 &&
|
||||
extents.width == GDK_SURFACE (self)->width &&
|
||||
extents.height == GDK_SURFACE (self)->height);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char *
|
||||
_gdk_macos_surface_get_title (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -636,7 +613,7 @@ _gdk_macos_surface_set_native (GdkMacosSurface *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_macos_surface_get_native_window: (attributes org.gtk.Method.get_property=native)
|
||||
* gdk_macos_surface_get_native_window:
|
||||
* @self: a #GdkMacosSurface
|
||||
*
|
||||
* Gets the underlying NSWindow used by the surface.
|
||||
|
||||
@@ -617,6 +617,14 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
|
||||
/* Workaround: if we use full transparency, window rendering becomes slow,
|
||||
* because macOS tries to dynamically calculate the shadow.
|
||||
* Instead provide a tiny bit of alpha, so shadows are drawn around the window.
|
||||
*/
|
||||
[window setBackgroundColor:[[NSColor blackColor] colorWithAlphaComponent:0.00001]];
|
||||
|
||||
/* Allow NSWindow to go fullscreen */
|
||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user