Compare commits
531 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c5e8515b7 | |||
| 37c24ba186 | |||
| 0dcb35047e | |||
| 971ee42321 | |||
| 3b027cf466 | |||
| 5d4f2822d0 | |||
| 5a11ee7b9c | |||
| 874410129e | |||
| 2cf1651235 | |||
| ad2221ce29 | |||
| 6dd0be2f06 | |||
| 2103ab99a5 | |||
| d7ab7e9628 | |||
| 3d7ac47e5e | |||
| c373e2c76b | |||
| ec3b27bb68 | |||
| 5b87dba1a3 | |||
| 12dcaf1e7a | |||
| 5031f30f28 | |||
| ad465e81aa | |||
| 39374c7209 | |||
| 170a1cd941 | |||
| 6074a18e3e | |||
| 5d5b612630 | |||
| 5942252175 | |||
| 9a3898fe89 | |||
| c6a3efaf70 | |||
| 9870234294 | |||
| 64ecb972cf | |||
| ded6d400d7 | |||
| 979a37d3f7 | |||
| 270e6165f4 | |||
| df51d474fc | |||
| 1e0ab6f249 | |||
| deb4de6332 | |||
| b4c7dd770c | |||
| 7488644176 | |||
| 9ed7cecd42 | |||
| df36ab3f93 | |||
| 7e4fdea71b | |||
| ea8062e86a | |||
| c4efe7709b | |||
| fdea496883 | |||
| 60878e4186 | |||
| 02297138f3 | |||
| 6603e02beb | |||
| bfb7573810 | |||
| 6847c3469d | |||
| 7a1e5b4418 | |||
| 76980e10a0 | |||
| 34f4a06691 | |||
| 2dea5ae958 | |||
| 5856716188 | |||
| 1c4a0dae62 | |||
| b7fba6298f | |||
| 5ce196fe9f | |||
| c31c89c794 | |||
| 1eb8c3ea34 | |||
| b2414b1ecd | |||
| fd3dfaf2c3 | |||
| 43a6c8c5f5 | |||
| 3789191853 | |||
| eb4fb2af0e | |||
| fd02afa2e4 | |||
| 55bb77cffc | |||
| 119ba5844f | |||
| 9b2b5ebb65 | |||
| 1624455a32 | |||
| d483883f38 | |||
| 0dc0bea1d5 | |||
| 55e31b972c | |||
| 1013874de8 | |||
| c397460c11 | |||
| ff0045b8c9 | |||
| d0b409d349 | |||
| c0cb10262d | |||
| 279a5f7825 | |||
| 6fa87d4f37 | |||
| fe35daaf34 | |||
| c3b836951a | |||
| ec10f1fe16 | |||
| ae741a06c0 | |||
| 754c9cb323 | |||
| a3683a080b | |||
| 0673d74986 | |||
| 8c46df425e | |||
| ff78e1888b | |||
| f2f219f304 | |||
| bb46edcc21 | |||
| 24173e3f93 | |||
| ec73bcb05b | |||
| 6c74c9c970 | |||
| c9c35ae41d | |||
| 95cea06462 | |||
| d01ca53bde | |||
| 3d3cafefc8 | |||
| 86cdb0ceb2 | |||
| 0c97c86573 | |||
| 10fa570195 | |||
| e18c553457 | |||
| 187763d286 | |||
| e6ae136de0 | |||
| 81efb63073 | |||
| cbadb1ed8e | |||
| 103e98f570 | |||
| 3768c751c5 | |||
| e42014573a | |||
| a9f1ff471b | |||
| e26a1bbda9 | |||
| b2ae7a2448 | |||
| cb682c759d | |||
| b154c9caf4 | |||
| 523fca21e9 | |||
| 73ddde6eda | |||
| 403da9a2d5 | |||
| fb6f211869 | |||
| c358606a46 | |||
| b7e5a79468 | |||
| 06bcb0ee47 | |||
| 58ce0a39dc | |||
| 6d3c333208 | |||
| 62c3923e5a | |||
| 3be8b1d927 | |||
| 27a61e221f | |||
| 52df3481d6 | |||
| ccb993d87b | |||
| 5fdaa4a232 | |||
| 8b166dff74 | |||
| f6b3f321a4 | |||
| a314143a83 | |||
| 6c7abf425a | |||
| b11e45762b | |||
| d041a681a5 | |||
| d22d2f77a6 | |||
| 7458461d06 | |||
| 283615936b | |||
| 2274bca95b | |||
| f8b4deeac0 | |||
| afa503c2e0 | |||
| 105f5f1137 | |||
| b83ad60a1f | |||
| 58b44ebc1c | |||
| b598f21506 | |||
| d3c166d511 | |||
| 76e93206f3 | |||
| ecfe47af73 | |||
| f20ca9067e | |||
| 8f3cd4733c | |||
| 402ee9b39c | |||
| becbf4e1f9 | |||
| 67407d5dcf | |||
| fcc0f243cf | |||
| 282dcfa9ac | |||
| 8c04801f6a | |||
| abe2d1cb16 | |||
| e407d22b1e | |||
| 37cefde5b0 | |||
| 310a4a3bf6 | |||
| e6896aa8dc | |||
| 36ce68a3ca | |||
| 797343da59 | |||
| bd3223d452 | |||
| 87a1a17868 | |||
| 70f386bd68 | |||
| 0af89088ba | |||
| 7342317c31 | |||
| 8d8bd4efba | |||
| 0ae3c8968e | |||
| 5e3f13acd1 | |||
| 32cdf35583 | |||
| 2f670bdc59 | |||
| 8d5660b4ab | |||
| 2a39f427e1 | |||
| ca86294325 | |||
| 820ba1ef13 | |||
| 9507130dbc | |||
| d2dede635b | |||
| 5a7fc4054b | |||
| 7fe22845e3 | |||
| 6c9a7cc708 | |||
| feeca98270 | |||
| 7c27241479 | |||
| fb73040d70 | |||
| bbe74abf51 | |||
| 34bd3fc854 | |||
| 940b5af2a8 | |||
| 0929d77f7f | |||
| 617297ddd7 | |||
| 67cec180ca | |||
| bab8f2f976 | |||
| 4801c3275e | |||
| 39354b3b99 | |||
| 661e953558 | |||
| 039b97ef9e | |||
| 630699fb68 | |||
| 3f4a414b1d | |||
| 4569b1ab40 | |||
| a484e8fc37 | |||
| d51bf6d905 | |||
| 358b0b4d13 | |||
| 97e0f872a2 | |||
| de74fa0836 | |||
| 42d26720d6 | |||
| c7dfb8cb55 | |||
| 8648a67c10 | |||
| f9b3ce95c2 | |||
| c828813d78 | |||
| 5935dc174f | |||
| b623b2acef | |||
| cc867eeccf | |||
| 17bdb4c8fb | |||
| 236b6d1cd6 | |||
| 9ded3e64a2 | |||
| 6e714722c4 | |||
| 60b1496091 | |||
| dc1b2d4117 | |||
| e205f13495 | |||
| 72718b7193 | |||
| db95e37e15 | |||
| f9714cc054 | |||
| 58c49ce6b0 | |||
| 13364cea74 | |||
| f6014bdc08 | |||
| 6070edfa61 | |||
| 0600357373 | |||
| 7873ebac2a | |||
| 8edd376ab8 | |||
| 6f300557bf | |||
| bcda071d7d | |||
| 9df3a50c87 | |||
| 70d41583b3 | |||
| a50df37d52 | |||
| b7d07ae190 | |||
| 3610ac0fd1 | |||
| 9f855eecb1 | |||
| ffc8f34dfd | |||
| 7acc1c0125 | |||
| 6059eaf355 | |||
| 26971c48d4 | |||
| b42caef0ed | |||
| b3706daf90 | |||
| 24dc9dc653 | |||
| 172dfb14c4 | |||
| 3b43078b08 | |||
| f2e75529cb | |||
| eed58b4051 | |||
| 28a01ca954 | |||
| efd5395ecf | |||
| 376dbe9def | |||
| bba7979670 | |||
| 01aafc6e65 | |||
| fa86bfcb55 | |||
| c3d9f4a9ac | |||
| d11ac3585d | |||
| 8f78a0f809 | |||
| 3286d9f1b5 | |||
| ee38c96ee3 | |||
| e5705bd141 | |||
| 753d74d676 | |||
| 670b4aabac | |||
| eba9316c12 | |||
| 7f3835cc4f | |||
| be89fa7919 | |||
| 20d6938a90 | |||
| 6f4f4d0123 | |||
| 250322deb0 | |||
| bdee95c32c | |||
| 1ffd23dbab | |||
| e92bd4d9ce | |||
| 24841a8d5b | |||
| c2dc459167 | |||
| d87ce14869 | |||
| e9735f0c35 | |||
| d320373262 | |||
| a84fe6bde6 | |||
| a8748598b6 | |||
| 748acaf654 | |||
| 1ff9d1545d | |||
| e35670a014 | |||
| 9690c87736 | |||
| a60d96a9ac | |||
| 0a9b501743 | |||
| 6dd55e381d | |||
| abd8d40bf9 | |||
| 348e938698 | |||
| 4e0a909ca9 | |||
| 8964f6f0cc | |||
| b807b84e16 | |||
| 97a2c3a656 | |||
| 5925c4c51f | |||
| 0fa2ae48d4 | |||
| 43303bf7e5 | |||
| f26f491d58 | |||
| a9b46e8409 | |||
| 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 | |||
| 9b6063c07c | |||
| d1a4740894 | |||
| 5186c4dc45 | |||
| ca9664cdfd | |||
| 6c9edbf0da | |||
| b8d2b1d3ce | |||
| 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 | |||
| 105ff3a25f | |||
| 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 | |||
| cba4ce03e5 | |||
| 5e82ad3ea7 | |||
| 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 | |||
| 2e2dab9c3d | |||
| a6eea6ba3c | |||
| 48f347e62b | |||
| ed1c047cf2 | |||
| ea9c2a72d9 | |||
| f4bd883003 | |||
| 0fcdadc531 | |||
| ffeca06bd6 | |||
| 83035c1d4b | |||
| 6435d5083a | |||
| 4da8d39ec5 |
+3
-5
@@ -68,7 +68,6 @@ style-check-diff:
|
||||
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gl.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gles2.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
@@ -119,8 +118,9 @@ release-build:
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- mkdir _install
|
||||
- export PATH="$HOME/.local/bin:${CI_PROJECT_DIR}/_install/bin:$PATH"
|
||||
- .gitlab-ci/install-meson-project.sh --prefix ${CI_PROJECT_DIR}/_install https://gitlab.gnome.org/jadahl/catch.git main
|
||||
# don't use catch by default, since it causes sporadic test failures
|
||||
# - export PATH="$HOME/.local/bin:${CI_PROJECT_DIR}/_install/bin:$PATH"
|
||||
# - .gitlab-ci/install-meson-project.sh --prefix ${CI_PROJECT_DIR}/_install https://gitlab.gnome.org/jadahl/catch.git main
|
||||
- meson subprojects download
|
||||
- meson subprojects update --reset
|
||||
- meson setup
|
||||
@@ -135,8 +135,6 @@ release-build:
|
||||
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
|
||||
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
|
||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||
# only repeat test runs that are likely affected by test setups
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles2 gtk:gdk,gtk:gsk-gl
|
||||
|
||||
fedora-clang:
|
||||
extends: .build-fedora-default
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
<!--
|
||||
- Which version of GTK you are using
|
||||
- What operating system and version
|
||||
- For Linux, which distribution
|
||||
- What windowing system (X11 or Wayland)
|
||||
- What graphics driver / mesa version
|
||||
- For Linux, which distribution
|
||||
- If you built GTK yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
|
||||
@@ -1,3 +1,187 @@
|
||||
Overview of Changes in 4.17.0, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
|
||||
Overview of Changes in 4.16.2, 09-25-2024
|
||||
=========================================
|
||||
|
||||
* GtkLabel:
|
||||
- Fix centered text in RTL
|
||||
|
||||
* Gsk:
|
||||
- Speed up some Vulkan operations
|
||||
- Improve startup speed by avoiding initialization
|
||||
of GL and Vulkan in most cases
|
||||
- Reduce critials at startup to warnings
|
||||
- Fix a crash on startup with some Vulkan drivers
|
||||
- Fix a big texture leak in NGL
|
||||
|
||||
* Gdk:
|
||||
- Speed up memory format conversions
|
||||
|
||||
* Wayland:
|
||||
- Be more careful with mimetypes during DND or copy-paste
|
||||
|
||||
* Tools:
|
||||
- builder-tool: Improve conversion of boxes
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
Bulgarian
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Georgian
|
||||
German
|
||||
Hebrew
|
||||
Indonesian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.16.1, 09-16-2024
|
||||
=========================================
|
||||
|
||||
* GtkFileChooser:
|
||||
- Plug a memory leak
|
||||
|
||||
* GtkCalendar:
|
||||
- Avoid ending up with invalid dates
|
||||
|
||||
* Printing:
|
||||
- Fix initial printer selection in the print dialog
|
||||
|
||||
* Gsk:
|
||||
- Fix shadows for opaque textures
|
||||
- Fix a crash in a corner case
|
||||
|
||||
* Css:
|
||||
- Make relative paths work again in theme files
|
||||
|
||||
* Accessibility:
|
||||
- Fix detection of the Flatpak portal
|
||||
|
||||
* MacOS:
|
||||
- Fix keyboard input in popovers
|
||||
- Keep DND icons above regular windows
|
||||
- Ignore events from DND icons
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
British English
|
||||
Bulgarian
|
||||
Czech
|
||||
Danish
|
||||
Georgian
|
||||
Hungarian
|
||||
Lithuanian
|
||||
Portuguese
|
||||
Spanish
|
||||
Swedish
|
||||
|
||||
|
||||
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
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -136,9 +136,13 @@ In the bug report please include:
|
||||
|
||||
- which version of GTK you are using
|
||||
- what operating system and version
|
||||
- what windowing system (X11 or Wayland)
|
||||
- what graphics driver / mesa version
|
||||
- for Linux, which distribution
|
||||
- if you built GTK, the list of options used to configure the build
|
||||
|
||||
Most of this information can be found in the GTK inspector.
|
||||
|
||||
And anything else you think is relevant.
|
||||
|
||||
* How to reproduce the bug.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
uniform float u_time;
|
||||
|
||||
void
|
||||
mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
vec2 pos = (fragCoord.xy * 2.0 - resolution.xy)/ min (resolution.x, resolution.y) ;
|
||||
|
||||
float t0 = sin ((u_time + 0.00)*1.0);
|
||||
float t1 = sin ((u_time + 0.30)*0.4);
|
||||
float t2 = cos ((u_time + 0.23)*0.9);
|
||||
float t3 = cos ((u_time + 0.41)*0.6);
|
||||
float t4 = cos ((u_time + 0.11)*0.3);
|
||||
|
||||
vec2 p0 = vec2 (t1, t0) ;
|
||||
vec2 p1 = vec2 (t2, t3) ;
|
||||
vec2 p2 = vec2 (t4, t3) ;
|
||||
|
||||
float r = 1.0/distance (pos, p0);
|
||||
float g = 1.0/distance (pos, p1);
|
||||
float b = 1.0/distance (pos, p2);
|
||||
float sum = r + g + b;
|
||||
|
||||
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
|
||||
|
||||
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
uniform float iTime;
|
||||
|
||||
// Originally from: https://www.shadertoy.com/view/3ljyDD
|
||||
// License CC0: Hexagonal tiling + cog wheels
|
||||
// Nothing fancy, just hexagonal tiling + cog wheels
|
||||
|
||||
#define PI 3.141592654
|
||||
#define TAU (2.0*PI)
|
||||
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
|
||||
|
||||
float hash(in vec2 co) {
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
|
||||
}
|
||||
|
||||
float pcos(float a) {
|
||||
return 0.5 + 0.5*cos(a);
|
||||
}
|
||||
|
||||
void rot(inout vec2 p, float a) {
|
||||
float c = cos(a);
|
||||
float s = sin(a);
|
||||
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
|
||||
}
|
||||
|
||||
float modPolar(inout vec2 p, float repetitions) {
|
||||
float angle = 2.0*PI/repetitions;
|
||||
float a = atan(p.y, p.x) + angle/2.;
|
||||
float r = length(p);
|
||||
float c = floor(a/angle);
|
||||
a = mod(a,angle) - angle/2.;
|
||||
p = vec2(cos(a), sin(a))*r;
|
||||
// For an odd number of repetitions, fix cell index of the cell in -x direction
|
||||
// (cell index would be e.g. -5 and 5 in the two halves of the cell):
|
||||
if (abs(c) >= (repetitions/2.0)) c = abs(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
float pmin(float a, float b, float k) {
|
||||
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
|
||||
return mix( b, a, h ) - k*h*(1.0-h);
|
||||
}
|
||||
|
||||
const vec2 sz = vec2(1.0, sqrt(3.0));
|
||||
const vec2 hsz = 0.5*sz;
|
||||
const float smallCount = 16.0;
|
||||
|
||||
vec2 hextile(inout vec2 p) {
|
||||
// See Art of Code: Hexagonal Tiling Explained!
|
||||
// https://www.youtube.com/watch?v=VmrIDyYiJBA
|
||||
|
||||
vec2 p1 = mod(p, sz)-hsz;
|
||||
vec2 p2 = mod(p - hsz*1.0, sz)-hsz;
|
||||
vec2 p3 = mix(p2, p1, vec2(length(p1) < length(p2)));
|
||||
vec2 n = p3 - p;
|
||||
p = p3;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float circle(vec2 p, float r) {
|
||||
return length(p) - r;
|
||||
}
|
||||
|
||||
float box(vec2 p, vec2 b) {
|
||||
vec2 d = abs(p)-b;
|
||||
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
|
||||
}
|
||||
|
||||
float unevenCapsule(vec2 p, float r1, float r2, float h) {
|
||||
p.x = abs(p.x);
|
||||
float b = (r1-r2)/h;
|
||||
float a = sqrt(1.0-b*b);
|
||||
float k = dot(p,vec2(-b,a));
|
||||
if( k < 0.0 ) return length(p) - r1;
|
||||
if( k > a*h ) return length(p-vec2(0.0,h)) - r2;
|
||||
return dot(p, vec2(a,b) ) - r1;
|
||||
}
|
||||
|
||||
float cogwheel(vec2 p, float innerRadius, float outerRadius, float cogs, float holes) {
|
||||
float cogWidth = 0.25*innerRadius*TAU/cogs;
|
||||
|
||||
float d0 = circle(p, innerRadius);
|
||||
|
||||
vec2 icp = p;
|
||||
modPolar(icp, holes);
|
||||
icp -= vec2(innerRadius*0.55, 0.0);
|
||||
float d1 = circle(icp, innerRadius*0.25);
|
||||
|
||||
vec2 cp = p;
|
||||
modPolar(cp, cogs);
|
||||
cp -= vec2(innerRadius, 0.0);
|
||||
float d2 = unevenCapsule(cp.yx, cogWidth, cogWidth*0.75, (outerRadius-innerRadius));
|
||||
|
||||
float d3 = circle(p, innerRadius*0.20);
|
||||
|
||||
float d = 1E6;
|
||||
d = min(d, d0);
|
||||
d = pmin(d, d2, 0.5*cogWidth);
|
||||
d = min(d, d2);
|
||||
d = max(d, -d1);
|
||||
d = max(d, -d3);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
float ccell1(vec2 p, float r) {
|
||||
float d = 1E6;
|
||||
const float bigCount = 60.0;
|
||||
|
||||
vec2 cp0 = p;
|
||||
rot(cp0, -iTime*TAU/bigCount);
|
||||
float d0 = cogwheel(cp0, 0.36, 0.38, bigCount, 5.0);
|
||||
|
||||
vec2 cp1 = p;
|
||||
float nm = modPolar(cp1, 6.0);
|
||||
|
||||
cp1 -= vec2(0.5, 0.0);
|
||||
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
|
||||
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
|
||||
|
||||
d = min(d, d0);
|
||||
d = min(d, d1);
|
||||
return d;
|
||||
}
|
||||
|
||||
float ccell2(vec2 p, float r) {
|
||||
float d = 1E6;
|
||||
vec2 cp0 = p;
|
||||
float nm = modPolar(cp0, 6.0);
|
||||
vec2 cp1 = cp0;
|
||||
const float off = 0.275;
|
||||
const float count = smallCount + 2.0;
|
||||
cp0 -= vec2(off, 0.0);
|
||||
rot(cp0, 0.+TAU*nm/2.0 - iTime*TAU/count);
|
||||
float d0 = cogwheel(cp0, 0.09, 0.105, count, 5.0);
|
||||
|
||||
|
||||
cp1 -= vec2(0.5, 0.0);
|
||||
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
|
||||
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
|
||||
|
||||
float l = length(p);
|
||||
float d2 = l - (off+0.055);
|
||||
float d3 = d2 + 0.020;;
|
||||
|
||||
vec2 tp0 = p;
|
||||
modPolar(tp0, 60.0);
|
||||
tp0.x -= off;
|
||||
float d4 = box(tp0, vec2(0.0125, 0.005));
|
||||
|
||||
float ctime = -(iTime*0.05 + r)*TAU;
|
||||
|
||||
vec2 tp1 = p;
|
||||
rot(tp1, ctime*12.0);
|
||||
tp1.x -= 0.13;
|
||||
float d5 = box(tp1, vec2(0.125, 0.005));
|
||||
|
||||
vec2 tp2 = p;
|
||||
rot(tp2, ctime);
|
||||
tp2.x -= 0.13*0.5;
|
||||
float d6 = box(tp2, vec2(0.125*0.5, 0.0075));
|
||||
|
||||
float d7 = l - 0.025;
|
||||
float d8 = l - 0.0125;
|
||||
|
||||
d = min(d, d0);
|
||||
d = min(d, d1);
|
||||
d = min(d, d2);
|
||||
d = max(d, -d3);
|
||||
d = min(d, d4);
|
||||
d = min(d, d5);
|
||||
d = min(d, d6);
|
||||
d = min(d, d7);
|
||||
d = max(d, -d8);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
float df(vec2 p, float scale, inout vec2 nn) {
|
||||
p /= scale;
|
||||
nn = hextile(p);
|
||||
nn = floor(nn + 0.5);
|
||||
float r = hash(nn);
|
||||
|
||||
float d;;
|
||||
|
||||
if (r < 0.5) {
|
||||
d = ccell1(p, r);
|
||||
} else {
|
||||
d = ccell2(p, r);
|
||||
}
|
||||
|
||||
return d*scale;
|
||||
}
|
||||
|
||||
vec3 postProcess(vec3 col, vec2 q) {
|
||||
//col = saturate(col);
|
||||
col=pow(clamp(col,0.0,1.0),vec3(0.75));
|
||||
col=col*0.6+0.4*col*col*(3.0-2.0*col); // contrast
|
||||
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4); // satuation
|
||||
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); // vigneting
|
||||
return col;
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv) {
|
||||
vec2 q = fragCoord/resolution.xy;
|
||||
vec2 p = -1.0 + 2.0*q;
|
||||
p.x *= resolution.x/resolution.y;
|
||||
float tm = iTime*0.1;
|
||||
p += vec2(cos(tm), sin(tm*sqrt(0.5)));
|
||||
float z = mix(0.5, 1.0, pcos(tm*sqrt(0.3)));
|
||||
float aa = 4.0 / resolution.y;
|
||||
|
||||
vec2 nn = vec2(0.0);
|
||||
float d = df(p, z, nn);
|
||||
|
||||
vec3 col = vec3(160.0)/vec3(255.0);
|
||||
vec3 baseCol = vec3(0.3);
|
||||
vec4 logoCol = vec4(baseCol, 1.0)*smoothstep(-aa, 0.0, -d);
|
||||
col = mix(col, logoCol.xyz, pow(logoCol.w, 8.0));
|
||||
col += 0.4*pow(abs(sin(20.0*d)), 0.6);
|
||||
|
||||
col = postProcess(col, q);
|
||||
|
||||
fragColor = vec4(col, 1.0);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/crosswarp
|
||||
// Author: Eke Péter <peterekepeter@gmail.com>
|
||||
// License: MIT
|
||||
|
||||
vec4 transition(vec2 p) {
|
||||
float x = progress;
|
||||
x=smoothstep(.0,1.0,(x*2.0+p.x-1.0));
|
||||
return mix(getFromColor((p-.5)*(1.-x)+.5), getToColor((p-.5)*x+.5), x);
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
||||
@@ -146,21 +146,6 @@
|
||||
<file>cogs.glsl</file>
|
||||
<file>glowingstars.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/gltransition">
|
||||
<file>gtkshaderstack.c</file>
|
||||
<file>gtkshaderstack.h</file>
|
||||
<file>gtkshaderbin.h</file>
|
||||
<file>gtkshaderbin.c</file>
|
||||
<file>gskshaderpaintable.h</file>
|
||||
<file>gskshaderpaintable.c</file>
|
||||
<file>wind.glsl</file>
|
||||
<file>radial.glsl</file>
|
||||
<file>crosswarp.glsl</file>
|
||||
<file>kaleidoscope.glsl</file>
|
||||
<file>cogs2.glsl</file>
|
||||
<file>ripple.glsl</file>
|
||||
<file>background.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/iconscroll">
|
||||
<file>iconscroll.ui</file>
|
||||
</gresource>
|
||||
@@ -296,7 +281,6 @@
|
||||
<file>gears.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>gltransition.c</file>
|
||||
<file>headerbar.c</file>
|
||||
<file>hypertext.c</file>
|
||||
<file>iconscroll.c</file>
|
||||
@@ -454,6 +438,10 @@
|
||||
<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>
|
||||
<file compressed="true">Moby-Dick.txt</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,
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "gtkfishbowl.h"
|
||||
#include "gtkgears.h"
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
#include "nodewidget.h"
|
||||
#include "graphwidget.h"
|
||||
@@ -152,46 +151,6 @@ create_switch (void)
|
||||
return w;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_paintable (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer user_data)
|
||||
{
|
||||
GskShaderPaintable *paintable;
|
||||
gint64 frame_time;
|
||||
|
||||
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
|
||||
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
gsk_shader_paintable_update_time (paintable, 0, frame_time);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_cogs (void)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
GtkWidget *picture;
|
||||
static GskGLShader *cog_shader = NULL;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
if (cog_shader == NULL)
|
||||
cog_shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
|
||||
paintable = gsk_shader_paintable_new (g_object_ref (cog_shader), NULL);
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_set_size_request (picture, 150, 75);
|
||||
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
|
||||
|
||||
return picture;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_cogs (GtkFishbowl *fb)
|
||||
{
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
|
||||
}
|
||||
|
||||
static void
|
||||
mapped (GtkWidget *w)
|
||||
{
|
||||
@@ -241,7 +200,6 @@ static const struct {
|
||||
{ "Gears", create_gears, NULL },
|
||||
{ "Switch", create_switch, NULL },
|
||||
{ "Menubutton", create_menu_button, NULL },
|
||||
{ "Shader", create_cogs, check_cogs },
|
||||
{ "Tiger", create_tiger, NULL },
|
||||
{ "Graph", create_graph, NULL },
|
||||
};
|
||||
|
||||
@@ -276,7 +276,7 @@ gtk_font_plane_class_init (GtkFontPlaneClass *class)
|
||||
|
||||
GtkWidget *
|
||||
gtk_font_plane_new (GtkAdjustment *weight_adj,
|
||||
GtkAdjustment *width_adj)
|
||||
GtkAdjustment *width_adj)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_FONT_PLANE,
|
||||
"weight-adjustment", weight_adj,
|
||||
|
||||
@@ -55,7 +55,7 @@ struct _GtkFontPlaneClass
|
||||
|
||||
|
||||
GType gtk_font_plane_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gtk_font_plane_new (GtkAdjustment *width_adj,
|
||||
GtkAdjustment *weight_adj);
|
||||
GtkWidget * gtk_font_plane_new (GtkAdjustment *weight_adj,
|
||||
GtkAdjustment *width_adj);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -1,366 +0,0 @@
|
||||
/* OpenGL/Transitions and Effects
|
||||
* #Keywords: OpenGL, shader, effect
|
||||
*
|
||||
* Create transitions between pages using a custom fragment shader.
|
||||
*
|
||||
* The example transitions here are taken from gl-transitions.com, and you
|
||||
* can edit the shader code itself on the last page of the stack.
|
||||
*
|
||||
* The transitions work with arbitrary content. We use images, shaders
|
||||
* GL areas and plain old widgets to demonstrate this.
|
||||
*
|
||||
* The demo also shows some over-the-top effects like wobbly widgets,
|
||||
* and animated backgrounds.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkshaderstack.h"
|
||||
#include "gtkshaderbin.h"
|
||||
#include "gtkshadertoy.h"
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *demo_window = NULL;
|
||||
|
||||
static void
|
||||
close_window (GtkWidget *widget)
|
||||
{
|
||||
/* Reset the state */
|
||||
demo_window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
GtkWidget *button)
|
||||
{
|
||||
gtk_widget_set_visible (button, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
apply_text (GtkWidget *button,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkWidget *stack;
|
||||
GskGLShader *shader;
|
||||
GtkTextIter start, end;
|
||||
char *text;
|
||||
|
||||
stack = g_object_get_data (G_OBJECT (button), "the-stack");
|
||||
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
|
||||
|
||||
GBytes *bytes = g_bytes_new_take (text, strlen (text));
|
||||
shader = gsk_gl_shader_new_from_bytes (bytes);
|
||||
|
||||
gtk_shader_stack_set_shader (GTK_SHADER_STACK (stack), shader);
|
||||
|
||||
g_object_unref (shader);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
gtk_widget_set_visible (button, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
go_back (GtkWidget *button,
|
||||
GtkWidget *stack)
|
||||
{
|
||||
gtk_shader_stack_transition (GTK_SHADER_STACK (stack), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
go_forward (GtkWidget *button,
|
||||
GtkWidget *stack)
|
||||
{
|
||||
gtk_shader_stack_transition (GTK_SHADER_STACK (stack), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
clicked_cb (GtkGestureClick *gesture,
|
||||
guint n_pressed,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ripple_bin_new (void)
|
||||
{
|
||||
GtkWidget *bin = gtk_shader_bin_new ();
|
||||
static GskGLShader *shader = NULL;
|
||||
|
||||
if (shader == NULL)
|
||||
shader = gsk_gl_shader_new_from_resource ("/gltransition/ripple.glsl");
|
||||
|
||||
gtk_shader_bin_add_shader (GTK_SHADER_BIN (bin), shader, GTK_STATE_FLAG_PRELIGHT, GTK_STATE_FLAG_PRELIGHT, 20);
|
||||
|
||||
return bin;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
new_shadertoy (const char *path)
|
||||
{
|
||||
GBytes *shader;
|
||||
GtkWidget *toy;
|
||||
|
||||
toy = gtk_shadertoy_new ();
|
||||
shader = g_resources_lookup_data (path, 0, NULL);
|
||||
gtk_shadertoy_set_image_shader (GTK_SHADERTOY (toy),
|
||||
g_bytes_get_data (shader, NULL));
|
||||
g_bytes_unref (shader);
|
||||
|
||||
return toy;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_paintable (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer user_data)
|
||||
{
|
||||
GskShaderPaintable *paintable;
|
||||
gint64 frame_time;
|
||||
|
||||
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
|
||||
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
gsk_shader_paintable_update_time (paintable, 0, frame_time);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
make_shader_stack (const char *name,
|
||||
const char *resource_path,
|
||||
int active_child,
|
||||
GtkWidget *scale)
|
||||
{
|
||||
GtkWidget *stack, *child, *widget, *vbox, *hbox, *bin;
|
||||
GtkWidget *label, *button, *tv;
|
||||
GskGLShader *shader;
|
||||
GObjectClass *class;
|
||||
GParamSpecFloat *pspec;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkTextBuffer *buffer;
|
||||
GBytes *bytes;
|
||||
GtkEventController *controller;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
stack = gtk_shader_stack_new ();
|
||||
shader = gsk_gl_shader_new_from_resource (resource_path);
|
||||
gtk_shader_stack_set_shader (GTK_SHADER_STACK (stack), shader);
|
||||
g_object_unref (shader);
|
||||
|
||||
child = gtk_picture_new_for_resource ("/css_blendmodes/ducky.png");
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
|
||||
paintable = gsk_shader_paintable_new (shader, NULL);
|
||||
|
||||
child = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_add_tick_callback (child, update_paintable, NULL, NULL);
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
child = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
child = new_shadertoy ("/shadertoy/neon.glsl");
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
|
||||
class = g_type_class_ref (GTK_TYPE_SHADER_STACK);
|
||||
pspec = G_PARAM_SPEC_FLOAT (g_object_class_find_property (class, "duration"));
|
||||
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (scale));
|
||||
if (gtk_adjustment_get_lower (adjustment) == 0.0 &&
|
||||
gtk_adjustment_get_upper (adjustment) == 0.0)
|
||||
{
|
||||
gtk_adjustment_configure (adjustment,
|
||||
pspec->default_value,
|
||||
pspec->minimum,
|
||||
pspec->maximum,
|
||||
0.1, 0.5, 0);
|
||||
}
|
||||
|
||||
g_type_class_unref (class);
|
||||
|
||||
g_object_bind_property (adjustment, "value",
|
||||
stack, "duration",
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
widget = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (widget), TRUE);
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_widget_set_vexpand (widget, TRUE);
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
|
||||
g_signal_connect (controller, "released", G_CALLBACK (clicked_cb), NULL);
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (widget), controller);
|
||||
|
||||
tv = gtk_text_view_new ();
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
gtk_text_view_set_top_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
gtk_text_view_set_bottom_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||
bytes = g_resources_lookup_data (resource_path, 0, NULL);
|
||||
gtk_text_buffer_set_text (buffer,
|
||||
(const char *)g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes));
|
||||
g_bytes_unref (bytes);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (widget), tv);
|
||||
|
||||
gtk_box_append (GTK_BOX (child), widget);
|
||||
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
gtk_shader_stack_set_active (GTK_SHADER_STACK (stack), active_child);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
|
||||
widget = gtk_center_box_new ();
|
||||
label = gtk_label_new (name);
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_widget_set_size_request (label, -1, 26);
|
||||
gtk_center_box_set_center_widget (GTK_CENTER_BOX (widget), label);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("view-refresh-symbolic");
|
||||
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
|
||||
g_object_set_data (G_OBJECT (button), "the-stack", stack);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_add_css_class (button, "small");
|
||||
gtk_widget_set_visible (button, FALSE);
|
||||
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), widget);
|
||||
|
||||
GtkWidget *bin2 = ripple_bin_new ();
|
||||
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin2), stack);
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), bin2);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("go-previous-symbolic");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (go_back), stack);
|
||||
bin = ripple_bin_new ();
|
||||
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin), button);
|
||||
gtk_box_append (GTK_BOX (hbox), bin);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("go-next-symbolic");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (go_forward), stack);
|
||||
bin = ripple_bin_new ();
|
||||
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin), button);
|
||||
gtk_box_append (GTK_BOX (hbox), bin);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gltransition_window (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
|
||||
GdkPaintable *paintable;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transitions and Effects");
|
||||
headerbar = gtk_header_bar_new ();
|
||||
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
gtk_widget_set_size_request (scale, 100, -1);
|
||||
gtk_widget_set_tooltip_text (scale, "Transition duration");
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), scale);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
outer_grid = gtk_grid_new ();
|
||||
gtk_window_set_child (GTK_WINDOW (window), outer_grid);
|
||||
|
||||
paintable = gsk_shader_paintable_new (gsk_gl_shader_new_from_resource ("/gltransition/background.glsl"), NULL);
|
||||
background = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_add_tick_callback (background, update_paintable, NULL, NULL);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (outer_grid),
|
||||
background,
|
||||
0, 0, 1, 1);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_grid_attach (GTK_GRID (outer_grid),
|
||||
grid,
|
||||
0, 0, 1, 1);
|
||||
|
||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_margin_start (grid, 12);
|
||||
gtk_widget_set_margin_end (grid, 12);
|
||||
gtk_widget_set_margin_top (grid, 12);
|
||||
gtk_widget_set_margin_bottom (grid, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Wind", "/gltransition/wind.glsl", 0, scale),
|
||||
0, 0, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Radial", "/gltransition/radial.glsl", 1, scale),
|
||||
1, 0, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Crosswarp", "/gltransition/crosswarp.glsl", 2, scale),
|
||||
0, 1, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
|
||||
1, 1, 1, 1);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_string (provider, "button.small { padding: 0; }");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_gltransition (GtkWidget *do_widget)
|
||||
{
|
||||
if (!demo_window)
|
||||
demo_window = create_gltransition_window (do_widget);
|
||||
|
||||
if (!gtk_widget_get_visible (demo_window))
|
||||
gtk_widget_set_visible (demo_window, TRUE);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (demo_window));
|
||||
|
||||
return demo_window;
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -1,338 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2020 Red Hat, Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.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: Matthias Clasen <mclasen@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/**
|
||||
* GskShaderPaintable:
|
||||
*
|
||||
* `GskShaderPaintable` is an implementation of the `GdkPaintable` interface
|
||||
* that uses a `GskGLShader` to create pixels.
|
||||
*
|
||||
* You can set the uniform data that the shader needs for rendering
|
||||
* using gsk_shader_paintable_set_args(). This function can
|
||||
* be called repeatedly to change the uniform data for the next
|
||||
* snapshot.
|
||||
*
|
||||
* Commonly, time is passed to shaders as a float uniform containing
|
||||
* the elapsed time in seconds. The convenience API
|
||||
* gsk_shader_paintable_update_time() can be called from a `GtkTickCallback`
|
||||
* to update the time based on the frame time of the frame clock.
|
||||
*/
|
||||
|
||||
|
||||
struct _GskShaderPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GskGLShader *shader;
|
||||
GBytes *args;
|
||||
|
||||
gint64 start_time;
|
||||
};
|
||||
|
||||
struct _GskShaderPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_SHADER,
|
||||
PROP_ARGS,
|
||||
|
||||
N_PROPS,
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (paintable);
|
||||
|
||||
gtk_snapshot_push_gl_shader (snapshot, self->shader, &GRAPHENE_RECT_INIT(0, 0, width, height), g_bytes_ref (self->args));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gsk_shader_paintable_paintable_snapshot;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GskShaderPaintable, gsk_shader_paintable, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gsk_shader_paintable_paintable_init))
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHADER:
|
||||
gsk_shader_paintable_set_shader (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_ARGS:
|
||||
gsk_shader_paintable_set_args (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHADER:
|
||||
g_value_set_object (value, self->shader);
|
||||
break;
|
||||
|
||||
case PROP_ARGS:
|
||||
g_value_set_boxed (value, self->args);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_finalize (GObject *object)
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
|
||||
|
||||
g_clear_pointer (&self->args, g_bytes_unref);
|
||||
g_clear_object (&self->shader);
|
||||
|
||||
G_OBJECT_CLASS (gsk_shader_paintable_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_class_init (GskShaderPaintableClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->get_property = gsk_shader_paintable_get_property;
|
||||
gobject_class->set_property = gsk_shader_paintable_set_property;
|
||||
gobject_class->finalize = gsk_shader_paintable_finalize;
|
||||
|
||||
properties[PROP_SHADER] =
|
||||
g_param_spec_object ("shader", "Shader", "The shader",
|
||||
GSK_TYPE_GL_SHADER,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_ARGS] =
|
||||
g_param_spec_boxed ("args", "Arguments", "The uniform arguments",
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_init (GskShaderPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_new:
|
||||
* @shader: (transfer full) (nullable): the shader to use
|
||||
* @data: (transfer full) (nullable): uniform data
|
||||
*
|
||||
* Creates a paintable that uses the @shader to create
|
||||
* pixels. The shader must not require input textures.
|
||||
* If @data is %NULL, all uniform values are set to zero.
|
||||
*
|
||||
* Returns: (transfer full): a new `GskShaderPaintable`
|
||||
*/
|
||||
GdkPaintable *
|
||||
gsk_shader_paintable_new (GskGLShader *shader,
|
||||
GBytes *data)
|
||||
{
|
||||
GdkPaintable *ret;
|
||||
|
||||
g_return_val_if_fail (shader == NULL || GSK_IS_GL_SHADER (shader), NULL);
|
||||
|
||||
if (shader && !data)
|
||||
{
|
||||
int size = gsk_gl_shader_get_args_size (shader);
|
||||
data = g_bytes_new_take (g_new0 (guchar, size), size);
|
||||
}
|
||||
|
||||
ret = g_object_new (GSK_TYPE_SHADER_PAINTABLE,
|
||||
"shader", shader,
|
||||
"args", data,
|
||||
NULL);
|
||||
|
||||
g_clear_object (&shader);
|
||||
g_clear_pointer (&data, g_bytes_unref);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_set_shader:
|
||||
* @self: a `GskShaderPaintable`
|
||||
* @shader: the `GskGLShader` to use
|
||||
*
|
||||
* Sets the shader that the paintable will use
|
||||
* to create pixels. The shader must not require
|
||||
* input textures.
|
||||
*/
|
||||
void
|
||||
gsk_shader_paintable_set_shader (GskShaderPaintable *self,
|
||||
GskGLShader *shader)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_SHADER_PAINTABLE (self));
|
||||
g_return_if_fail (shader == NULL || GSK_IS_GL_SHADER (shader));
|
||||
g_return_if_fail (shader == NULL || gsk_gl_shader_get_n_textures (shader) == 0);
|
||||
|
||||
if (!g_set_object (&self->shader, shader))
|
||||
return;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SHADER]);
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_clear_pointer (&self->args, g_bytes_unref);
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_get_shader:
|
||||
* @self: a `GskShaderPaintable`
|
||||
*
|
||||
* Returns the shader that the paintable is using.
|
||||
*
|
||||
* Returns: (transfer none): the `GskGLShader` that is used
|
||||
*/
|
||||
GskGLShader *
|
||||
gsk_shader_paintable_get_shader (GskShaderPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GSK_IS_SHADER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->shader;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_set_args:
|
||||
* @self: a `GskShaderPaintable`
|
||||
* @data: Data block with uniform data for the shader
|
||||
*
|
||||
* Sets the uniform data that will be passed to the
|
||||
* shader when rendering. The @data will typically
|
||||
* be produced by a `GskUniformDataBuilder`.
|
||||
*
|
||||
* Note that the @data should be considered immutable
|
||||
* after it has been passed to this function.
|
||||
*/
|
||||
void
|
||||
gsk_shader_paintable_set_args (GskShaderPaintable *self,
|
||||
GBytes *data)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_SHADER_PAINTABLE (self));
|
||||
g_return_if_fail (data == NULL || g_bytes_get_size (data) == gsk_gl_shader_get_args_size (self->shader));
|
||||
|
||||
g_clear_pointer (&self->args, g_bytes_unref);
|
||||
if (data)
|
||||
self->args = g_bytes_ref (data);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ARGS]);
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_get_args:
|
||||
* @self: a `GskShaderPaintable`
|
||||
*
|
||||
* Returns the uniform data set with
|
||||
* gsk_shader_paintable_get_args().
|
||||
*
|
||||
* Returns: (transfer none): the uniform data
|
||||
*/
|
||||
GBytes *
|
||||
gsk_shader_paintable_get_args (GskShaderPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GSK_IS_SHADER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->args;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_update_time:
|
||||
* @self: a `GskShaderPaintable`
|
||||
* @time_idx: the index of the uniform for time in seconds as float
|
||||
* @frame_time: the current frame time, as returned by `GdkFrameClock`
|
||||
*
|
||||
* This function is a convenience wrapper for
|
||||
* gsk_shader_paintable_set_args() that leaves all
|
||||
* uniform values unchanged, except for the uniform with
|
||||
* index @time_idx, which will be set to the elapsed time
|
||||
* in seconds, since the first call to this function.
|
||||
*
|
||||
* This function is usually called from a `GtkTickCallback`.
|
||||
*/
|
||||
void
|
||||
gsk_shader_paintable_update_time (GskShaderPaintable *self,
|
||||
int time_idx,
|
||||
gint64 frame_time)
|
||||
{
|
||||
GskShaderArgsBuilder *builder;
|
||||
GBytes *args;
|
||||
float time;
|
||||
|
||||
if (self->start_time == 0)
|
||||
self->start_time = frame_time;
|
||||
|
||||
time = (frame_time - self->start_time) / (float)G_TIME_SPAN_SECOND;
|
||||
|
||||
builder = gsk_shader_args_builder_new (self->shader, self->args);
|
||||
gsk_shader_args_builder_set_float (builder, time_idx, time);
|
||||
args = gsk_shader_args_builder_free_to_args (builder);
|
||||
|
||||
gsk_shader_paintable_set_args (self, args);
|
||||
|
||||
g_bytes_unref (args);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2020 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.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: Matthias Clasen <mclasen@redhat.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gsk/gsk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
|
||||
GBytes *data);
|
||||
|
||||
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
|
||||
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
|
||||
GskGLShader *shader);
|
||||
GBytes * gsk_shader_paintable_get_args (GskShaderPaintable *self);
|
||||
void gsk_shader_paintable_set_args (GskShaderPaintable *self,
|
||||
GBytes *data);
|
||||
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
|
||||
int time_idx,
|
||||
gint64 frame_time);
|
||||
G_END_DECLS
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -55,7 +55,7 @@ void gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
gboolean gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
gboolean benchmark);
|
||||
double gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl);
|
||||
gint64 gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
#include "gtkshaderbin.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct {
|
||||
GskGLShader *shader;
|
||||
GtkStateFlags state;
|
||||
GtkStateFlags state_mask;
|
||||
float extra_border;
|
||||
gboolean compiled;
|
||||
gboolean compiled_ok;
|
||||
} ShaderInfo;
|
||||
|
||||
struct _GtkShaderBin
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
GtkWidget *child;
|
||||
ShaderInfo *active_shader;
|
||||
GPtrArray *shaders;
|
||||
guint tick_id;
|
||||
float time;
|
||||
float mouse_x, mouse_y;
|
||||
gint64 first_frame_time;
|
||||
};
|
||||
|
||||
struct _GtkShaderBinClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkShaderBin, gtk_shader_bin, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
shader_info_free (ShaderInfo *info)
|
||||
{
|
||||
g_object_unref (info->shader);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_finalize (GObject *object)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (object);
|
||||
|
||||
g_ptr_array_free (self->shaders, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_bin_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_dispose (GObject *object)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (object);
|
||||
|
||||
g_clear_pointer (&self->child, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_bin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_shader_bin_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (widget);
|
||||
gint64 frame_time;
|
||||
|
||||
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
if (self->first_frame_time == 0)
|
||||
self->first_frame_time = frame_time;
|
||||
self->time = (frame_time - self->first_frame_time) / (float)G_USEC_PER_SEC;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
motion_cb (GtkEventControllerMotion *controller,
|
||||
double x,
|
||||
double y,
|
||||
GtkShaderBin *self)
|
||||
{
|
||||
self->mouse_x = x;
|
||||
self->mouse_y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_init (GtkShaderBin *self)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
self->shaders = g_ptr_array_new_with_free_func ((GDestroyNotify)shader_info_free);
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (motion_cb), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_bin_update_active_shader (GtkShaderBin *self)
|
||||
{
|
||||
GtkStateFlags new_state = gtk_widget_get_state_flags (GTK_WIDGET (self));
|
||||
ShaderInfo *new_shader = NULL;
|
||||
|
||||
for (int i = 0; i < self->shaders->len; i++)
|
||||
{
|
||||
ShaderInfo *info = g_ptr_array_index (self->shaders, i);
|
||||
|
||||
if ((info->state_mask & new_state) == info->state)
|
||||
{
|
||||
new_shader = info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->active_shader == new_shader)
|
||||
return;
|
||||
|
||||
self->active_shader = new_shader;
|
||||
self->first_frame_time = 0;
|
||||
|
||||
if (self->active_shader)
|
||||
{
|
||||
if (self->tick_id == 0)
|
||||
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self),
|
||||
gtk_shader_bin_tick,
|
||||
NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->tick_id != 0)
|
||||
{
|
||||
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick_id);
|
||||
self->tick_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state_flags)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (widget);
|
||||
|
||||
gtk_shader_bin_update_active_shader (self);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_bin_add_shader (GtkShaderBin *self,
|
||||
GskGLShader *shader,
|
||||
GtkStateFlags state,
|
||||
GtkStateFlags state_mask,
|
||||
float extra_border)
|
||||
{
|
||||
ShaderInfo *info = g_new0 (ShaderInfo, 1);
|
||||
info->shader = g_object_ref (shader);
|
||||
info->state = state;
|
||||
info->state_mask = state_mask;
|
||||
info->extra_border = extra_border;
|
||||
|
||||
g_ptr_array_add (self->shaders, info);
|
||||
|
||||
gtk_shader_bin_update_active_shader (self);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_bin_set_child (GtkShaderBin *self,
|
||||
GtkWidget *child)
|
||||
{
|
||||
|
||||
if (self->child == child)
|
||||
return;
|
||||
|
||||
g_clear_pointer (&self->child, gtk_widget_unparent);
|
||||
|
||||
if (child)
|
||||
{
|
||||
self->child = child;
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (self));
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_shader_bin_get_child (GtkShaderBin *self)
|
||||
{
|
||||
return self->child;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (widget);
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
if (self->active_shader)
|
||||
{
|
||||
if (!self->active_shader->compiled)
|
||||
{
|
||||
GtkNative *native = gtk_widget_get_native (widget);
|
||||
GskRenderer *renderer = gtk_native_get_renderer (native);
|
||||
GError *error = NULL;
|
||||
|
||||
self->active_shader->compiled = TRUE;
|
||||
self->active_shader->compiled_ok =
|
||||
gsk_gl_shader_compile (self->active_shader->shader,
|
||||
renderer, &error);
|
||||
if (!self->active_shader->compiled_ok)
|
||||
{
|
||||
g_warning ("GtkShaderBin failed to compile shader: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
if (self->active_shader->compiled_ok)
|
||||
{
|
||||
float border = self->active_shader->extra_border;
|
||||
graphene_vec2_t mouse;
|
||||
graphene_vec2_init (&mouse, self->mouse_x + border, self->mouse_y + border);
|
||||
gtk_snapshot_push_gl_shader (snapshot, self->active_shader->shader,
|
||||
&GRAPHENE_RECT_INIT(-border, -border, width+2*border, height+2*border),
|
||||
gsk_gl_shader_format_args (self->active_shader->shader,
|
||||
"u_time", self->time,
|
||||
"u_mouse", &mouse,
|
||||
NULL));
|
||||
gtk_widget_snapshot_child (widget, self->child, snapshot);
|
||||
gtk_snapshot_gl_shader_pop_texture (snapshot);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-shader fallback */
|
||||
gtk_widget_snapshot_child (widget, self->child, snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_class_init (GtkShaderBinClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = gtk_shader_bin_finalize;
|
||||
object_class->dispose = gtk_shader_bin_dispose;
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
|
||||
widget_class->snapshot = gtk_shader_bin_snapshot;
|
||||
widget_class->state_flags_changed = gtk_shader_bin_state_flags_changed;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_shader_bin_new (void)
|
||||
{
|
||||
GtkShaderBin *self;
|
||||
|
||||
self = g_object_new (GTK_TYPE_SHADER_BIN, NULL);
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SHADER_BIN (gtk_shader_bin_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkShaderBin, gtk_shader_bin, GTK, SHADER_BIN, GtkWidget)
|
||||
|
||||
GtkWidget *gtk_shader_bin_new (void);
|
||||
void gtk_shader_bin_add_shader (GtkShaderBin *self,
|
||||
GskGLShader *shader,
|
||||
GtkStateFlags state,
|
||||
GtkStateFlags state_mask,
|
||||
float extra_border);
|
||||
void gtk_shader_bin_set_child (GtkShaderBin *self,
|
||||
GtkWidget *child);
|
||||
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -1,365 +0,0 @@
|
||||
#include "gtkshaderstack.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
struct _GtkShaderStack
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GskGLShader *shader;
|
||||
GPtrArray *children;
|
||||
int current;
|
||||
int next;
|
||||
gboolean backwards;
|
||||
|
||||
guint tick_id;
|
||||
float time;
|
||||
float duration;
|
||||
gint64 start_time;
|
||||
};
|
||||
|
||||
struct _GtkShaderStackClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
PROP_DURATION = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL };
|
||||
|
||||
G_DEFINE_TYPE (GtkShaderStack, gtk_shader_stack, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
gtk_shader_stack_finalize (GObject *object)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
g_object_unref (self->shader);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_stack_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
update_child_visible (GtkShaderStack *self)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < self->children->len; i++)
|
||||
{
|
||||
GtkWidget *child = g_ptr_array_index (self->children, i);
|
||||
|
||||
gtk_widget_set_child_visible (child,
|
||||
i == self->current || i == self->next);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
transition_cb (GtkWidget *widget,
|
||||
GdkFrameClock *clock,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
gint64 frame_time;
|
||||
|
||||
frame_time = gdk_frame_clock_get_frame_time (clock);
|
||||
|
||||
if (self->start_time == 0)
|
||||
self->start_time = frame_time;
|
||||
|
||||
self->time = (frame_time - self->start_time) / (float)G_USEC_PER_SEC;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
if (self->time >= self->duration)
|
||||
{
|
||||
self->current = self->next;
|
||||
self->next = -1;
|
||||
|
||||
update_child_visible (self);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
else
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
start_transition (GtkShaderStack *self)
|
||||
{
|
||||
self->start_time = 0;
|
||||
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self),
|
||||
transition_cb,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
stop_transition (GtkShaderStack *self)
|
||||
{
|
||||
if (self->tick_id != 0)
|
||||
{
|
||||
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick_id);
|
||||
self->tick_id = 0;
|
||||
}
|
||||
|
||||
if (self->next != -1)
|
||||
self->current = self->next;
|
||||
self->next = -1;
|
||||
|
||||
update_child_visible (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_dispose (GObject *object)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
stop_transition (self);
|
||||
|
||||
g_clear_pointer (&self->children, g_ptr_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_stack_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_transition (GtkShaderStack *self,
|
||||
gboolean forward)
|
||||
{
|
||||
stop_transition (self);
|
||||
|
||||
self->backwards = !forward;
|
||||
if (self->backwards)
|
||||
self->next = (self->current + self->children->len - 1) % self->children->len;
|
||||
else
|
||||
self->next = (self->current + 1) % self->children->len;
|
||||
|
||||
update_child_visible (self);
|
||||
|
||||
start_transition (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_init (GtkShaderStack *self)
|
||||
{
|
||||
self->children = g_ptr_array_new_with_free_func ((GDestroyNotify)gtk_widget_unparent);
|
||||
self->current = -1;
|
||||
self->next = -1;
|
||||
self->backwards = FALSE;
|
||||
self->duration = 1.0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
int i;
|
||||
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
|
||||
for (i = 0; i < self->children->len; i++)
|
||||
{
|
||||
GtkWidget *child = g_ptr_array_index (self->children, i);
|
||||
int child_min, child_nat;
|
||||
|
||||
if (gtk_widget_get_visible (child))
|
||||
{
|
||||
gtk_widget_measure (child, orientation, for_size, &child_min, &child_nat, NULL, NULL);
|
||||
|
||||
*minimum = MAX (*minimum, child_min);
|
||||
*natural = MAX (*natural, child_nat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
GtkAllocation child_allocation;
|
||||
GtkWidget *child;
|
||||
int i;
|
||||
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = height;
|
||||
|
||||
for (i = 0; i < self->children->len; i++)
|
||||
{
|
||||
child = g_ptr_array_index (self->children, i);
|
||||
if (gtk_widget_get_visible (child))
|
||||
gtk_widget_size_allocate (child, &child_allocation, -1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
int width, height;
|
||||
GtkWidget *current, *next;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
current = g_ptr_array_index (self->children, self->current);
|
||||
|
||||
if (self->next == -1)
|
||||
{
|
||||
gtk_widget_snapshot_child (widget, current, snapshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkNative *native = gtk_widget_get_native (widget);
|
||||
GskRenderer *renderer = gtk_native_get_renderer (native);
|
||||
float progress;
|
||||
|
||||
next = g_ptr_array_index (self->children, self->next);
|
||||
|
||||
progress = self->time / self->duration;
|
||||
|
||||
if (self->backwards)
|
||||
{
|
||||
GtkWidget *tmp = next;
|
||||
next = current;
|
||||
current = tmp;
|
||||
progress = 1. - progress;
|
||||
}
|
||||
|
||||
if (gsk_gl_shader_compile (self->shader, renderer, NULL))
|
||||
{
|
||||
gtk_snapshot_push_gl_shader (snapshot,
|
||||
self->shader,
|
||||
&GRAPHENE_RECT_INIT(0, 0, width, height),
|
||||
gsk_gl_shader_format_args (self->shader,
|
||||
"progress", progress,
|
||||
NULL));
|
||||
|
||||
gtk_widget_snapshot_child (widget, current, snapshot);
|
||||
gtk_snapshot_gl_shader_pop_texture (snapshot); /* current child */
|
||||
gtk_widget_snapshot_child (widget, next, snapshot);
|
||||
gtk_snapshot_gl_shader_pop_texture (snapshot); /* next child */
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Non-shader fallback */
|
||||
gtk_widget_snapshot_child (widget, current, snapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DURATION:
|
||||
g_value_set_float (value, self->duration);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DURATION:
|
||||
self->duration = g_value_get_float (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_class_init (GtkShaderStackClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = gtk_shader_stack_finalize;
|
||||
object_class->dispose = gtk_shader_stack_dispose;
|
||||
object_class->get_property = gtk_shader_stack_get_property;
|
||||
object_class->set_property = gtk_shader_stack_set_property;
|
||||
|
||||
widget_class->snapshot = gtk_shader_stack_snapshot;
|
||||
widget_class->measure = gtk_shader_stack_measure;
|
||||
widget_class->size_allocate = gtk_shader_stack_size_allocate;
|
||||
|
||||
properties[PROP_DURATION] =
|
||||
g_param_spec_float ("duration", "Duration", "Duration",
|
||||
0.1, 3.0, 1.0,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_shader_stack_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_SHADER_STACK, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_set_shader (GtkShaderStack *self,
|
||||
GskGLShader *shader)
|
||||
{
|
||||
g_set_object (&self->shader, shader);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_add_child (GtkShaderStack *self,
|
||||
GtkWidget *child)
|
||||
{
|
||||
g_ptr_array_add (self->children, child);
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (self));
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
|
||||
if (self->current == -1)
|
||||
self->current = 0;
|
||||
else
|
||||
gtk_widget_set_child_visible (child, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_set_active (GtkShaderStack *self,
|
||||
int index)
|
||||
{
|
||||
stop_transition (self);
|
||||
self->current = MIN (index, self->children->len);
|
||||
update_child_visible (self);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SHADER_STACK (gtk_shader_stack_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkShaderStack, gtk_shader_stack, GTK, SHADER_STACK, GtkWidget)
|
||||
|
||||
GtkWidget * gtk_shader_stack_new (void);
|
||||
void gtk_shader_stack_set_shader (GtkShaderStack *self,
|
||||
GskGLShader *shader);
|
||||
void gtk_shader_stack_add_child (GtkShaderStack *self,
|
||||
GtkWidget *child);
|
||||
void gtk_shader_stack_transition (GtkShaderStack *self,
|
||||
gboolean forward);
|
||||
void gtk_shader_stack_set_active (GtkShaderStack *self,
|
||||
int index);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
typedef struct _GdkHSLA GdkHSLA;
|
||||
|
||||
struct _GdkHSLA {
|
||||
|
||||
+73
-29
@@ -13,7 +13,7 @@ static GtkWidget *window = NULL;
|
||||
static GtkWidget *scrolledwindow;
|
||||
static int selected;
|
||||
|
||||
#define N_WIDGET_TYPES 8
|
||||
#define N_WIDGET_TYPES 9
|
||||
|
||||
|
||||
static int hincrement = 5;
|
||||
@@ -73,30 +73,77 @@ populate_icons (void)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), grid);
|
||||
}
|
||||
|
||||
static char *content;
|
||||
static gsize content_len;
|
||||
|
||||
extern void fontify (const char *format, GtkTextBuffer *buffer);
|
||||
|
||||
enum {
|
||||
PLAIN_TEXT,
|
||||
HIGHLIGHTED_TEXT,
|
||||
UNDERLINED_TEXT,
|
||||
};
|
||||
|
||||
static void
|
||||
populate_text (gboolean highlight)
|
||||
underlinify (GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextTagTable *tags;
|
||||
GtkTextTag *tag[3];
|
||||
GtkTextIter start, end;
|
||||
|
||||
tags = gtk_text_buffer_get_tag_table (buffer);
|
||||
tag[0] = gtk_text_tag_new ("error");
|
||||
tag[1] = gtk_text_tag_new ("strikeout");
|
||||
tag[2] = gtk_text_tag_new ("double");
|
||||
g_object_set (tag[0], "underline", PANGO_UNDERLINE_ERROR, NULL);
|
||||
g_object_set (tag[1], "strikethrough", TRUE, NULL);
|
||||
g_object_set (tag[2],
|
||||
"underline", PANGO_UNDERLINE_DOUBLE,
|
||||
"underline-rgba", &(GdkRGBA){0., 1., 1., 1. },
|
||||
NULL);
|
||||
gtk_text_tag_table_add (tags, tag[0]);
|
||||
gtk_text_tag_table_add (tags, tag[1]);
|
||||
gtk_text_tag_table_add (tags, tag[2]);
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &end);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
gtk_text_iter_forward_word_end (&end);
|
||||
start = end;
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
gtk_text_buffer_apply_tag (buffer, tag[g_random_int_range (0, 3)], &start, &end);
|
||||
if (!gtk_text_iter_forward_word_ends (&end, 3))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
populate_text (const char *resource, int kind)
|
||||
{
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *buffer;
|
||||
char *content;
|
||||
gsize content_len;
|
||||
GBytes *bytes;
|
||||
|
||||
if (!content)
|
||||
{
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
|
||||
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||
}
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, content, (int)content_len);
|
||||
|
||||
if (highlight)
|
||||
fontify ("c", buffer);
|
||||
switch (kind)
|
||||
{
|
||||
case HIGHLIGHTED_TEXT:
|
||||
fontify ("c", buffer);
|
||||
break;
|
||||
|
||||
case UNDERLINED_TEXT:
|
||||
underlinify (buffer);
|
||||
break;
|
||||
|
||||
case PLAIN_TEXT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
@@ -155,14 +202,6 @@ populate_image (void)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
if (!content)
|
||||
{
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
|
||||
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||
}
|
||||
|
||||
image = gtk_picture_new_for_resource ("/sliding_puzzle/portland-rose.jpg");
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (image), FALSE);
|
||||
|
||||
@@ -255,35 +294,40 @@ set_widget_type (int type)
|
||||
|
||||
case 1:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling plain text");
|
||||
populate_text (FALSE);
|
||||
populate_text ("/sources/font_features.c", PLAIN_TEXT);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling complex text");
|
||||
populate_text (TRUE);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling colored text");
|
||||
populate_text ("/sources/font_features.c", HIGHLIGHTED_TEXT);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling text with underlines");
|
||||
populate_text ("/org/gtk/Demo4/Moby-Dick.txt", UNDERLINED_TEXT);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling text with Emoji");
|
||||
populate_emoji_text ();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a big image");
|
||||
populate_image ();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a list");
|
||||
populate_list ();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a columned list");
|
||||
populate_list2 ();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a grid");
|
||||
populate_grid ();
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="resizable">0</property>
|
||||
<property name="resizable">1</property>
|
||||
<property name="default-width">500</property>
|
||||
<property name="default-height">500</property>
|
||||
<child type="titlebar">
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/kaleidoscope
|
||||
// Author: nwoeanhinnogaehr
|
||||
// License: MIT
|
||||
|
||||
const float speed = 1.0;
|
||||
const float angle = 1.0;
|
||||
const float power = 1.5;
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
vec2 p = uv.xy / vec2(1.0).xy;
|
||||
vec2 q = p;
|
||||
float t = pow(progress, power)*speed;
|
||||
p = p -0.5;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
p = vec2(sin(t)*p.x + cos(t)*p.y, sin(t)*p.y - cos(t)*p.x);
|
||||
t += angle;
|
||||
p = abs(mod(p, 2.0) - 1.0);
|
||||
}
|
||||
abs(mod(p, 1.0));
|
||||
return mix(
|
||||
mix(getFromColor(q), getToColor(q), progress),
|
||||
mix(getFromColor(p), getToColor(p), progress), 1.0 - 2.0*abs(progress - 0.5));
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 622 KiB |
@@ -355,28 +355,28 @@ create_clocks_model (void)
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
/* A bunch of timezones with GTK hackers */
|
||||
clock = gtk_clock_new ("San Francisco", g_time_zone_new ("America/Los_Angeles"));
|
||||
clock = gtk_clock_new ("San Francisco", g_time_zone_new_identifier ("America/Los_Angeles"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Xalapa", g_time_zone_new ("America/Mexico_City"));
|
||||
clock = gtk_clock_new ("Xalapa", g_time_zone_new_identifier ("America/Mexico_City"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Boston", g_time_zone_new ("America/New_York"));
|
||||
clock = gtk_clock_new ("Boston", g_time_zone_new_identifier ("America/New_York"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("London", g_time_zone_new ("Europe/London"));
|
||||
clock = gtk_clock_new ("London", g_time_zone_new_identifier ("Europe/London"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Berlin", g_time_zone_new ("Europe/Berlin"));
|
||||
clock = gtk_clock_new ("Berlin", g_time_zone_new_identifier ("Europe/Berlin"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Moscow", g_time_zone_new ("Europe/Moscow"));
|
||||
clock = gtk_clock_new ("Moscow", g_time_zone_new_identifier ("Europe/Moscow"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("New Delhi", g_time_zone_new ("Asia/Kolkata"));
|
||||
clock = gtk_clock_new ("New Delhi", g_time_zone_new_identifier ("Asia/Kolkata"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Shanghai", g_time_zone_new ("Asia/Shanghai"));
|
||||
clock = gtk_clock_new ("Shanghai", g_time_zone_new_identifier ("Asia/Shanghai"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
|
||||
|
||||
@@ -156,11 +156,6 @@ gtk_demo_run (GtkDemo *self,
|
||||
if (result == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (GTK_IS_WINDOW (result))
|
||||
{
|
||||
gtk_window_set_transient_for (GTK_WINDOW (result), GTK_WINDOW (window));
|
||||
gtk_window_set_modal (GTK_WINDOW (result), TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -832,9 +827,6 @@ static gboolean
|
||||
demo_can_run (GtkWidget *window,
|
||||
const char *name)
|
||||
{
|
||||
if (name != NULL && strcmp (name, "gltransition") == 0)
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1068,6 +1060,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;
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ demos = files([
|
||||
'gears.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
'gltransition.c',
|
||||
'headerbar.c',
|
||||
'hypertext.c',
|
||||
'iconscroll.c',
|
||||
@@ -117,10 +116,7 @@ extra_demo_sources = files([
|
||||
'gtkfishbowl.c',
|
||||
'fontplane.c',
|
||||
'gtkgears.c',
|
||||
'gtkshaderbin.c',
|
||||
'gtkshadertoy.c',
|
||||
'gtkshaderstack.c',
|
||||
'gskshaderpaintable.c',
|
||||
'hsla.c',
|
||||
'puzzlepiece.c',
|
||||
'bluroverlay.c',
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
#define NODE_TYPE_WIDGET (node_widget_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (NodeWidget, node_widget, NODE, WIDGET, GtkWidget)
|
||||
|
||||
GtkWidget * node_widget_new (const char *file);
|
||||
GtkWidget * node_widget_new (const char *resource);
|
||||
|
||||
@@ -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 |
@@ -1,34 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/Radial
|
||||
// License: MIT
|
||||
// Author: Xaychru
|
||||
|
||||
const float smoothness = 1.0;
|
||||
|
||||
const float PI = 3.141592653589;
|
||||
|
||||
vec4 transition(vec2 p) {
|
||||
vec2 rp = p*2.-1.;
|
||||
return mix(
|
||||
getToColor(p),
|
||||
getFromColor(p),
|
||||
smoothstep(0., smoothness, atan(rp.y,rp.x) - (progress-.5) * PI * 2.5)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
uniform float u_time;
|
||||
uniform vec2 u_mouse;
|
||||
uniform sampler2D u_texture1;
|
||||
|
||||
#define PI 3.141592654
|
||||
|
||||
float decay(float v, float t)
|
||||
{
|
||||
return v * (1.0 / (1.0 + t*t));
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
// Temporary to loop time every 1 sec
|
||||
float time = u_time;
|
||||
// we normalize all the effects according to the min height/width
|
||||
float size = min(resolution.x, resolution.y);
|
||||
|
||||
// Animate one wave over size in 0.3 sec
|
||||
float wave_speed = size / 0.3;
|
||||
float wave_length = size / 1.0;
|
||||
float wave_height = size * 0.1;
|
||||
|
||||
vec2 center = u_mouse;
|
||||
vec2 direction_from_center = fragCoord - center;
|
||||
float distance_from_center = length(direction_from_center);
|
||||
|
||||
/* Normalize direction */
|
||||
direction_from_center = direction_from_center / distance_from_center;
|
||||
|
||||
float propagation_length = time * wave_speed;
|
||||
|
||||
float t = (propagation_length - distance_from_center) / wave_length;
|
||||
float offset_magnitude = 0.0;
|
||||
if (t > 0.0)
|
||||
offset_magnitude = decay(wave_height * sin(t * 2.0 * PI), t);
|
||||
|
||||
vec2 offset = direction_from_center * min(offset_magnitude, distance_from_center);
|
||||
vec2 source = fragCoord - offset;
|
||||
|
||||
vec2 uv2 = source / resolution;
|
||||
fragColor = GskTexture(u_texture1, vec2(uv2.x, 1.0-uv2.y));
|
||||
}
|
||||
@@ -43,7 +43,7 @@ GtkListItemFactory *
|
||||
suggestion_entry_get_factory (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_use_filter (SuggestionEntry *self,
|
||||
gboolean use_ilter);
|
||||
gboolean use_filter);
|
||||
gboolean suggestion_entry_get_use_filter (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_expression (SuggestionEntry *self,
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/wind
|
||||
// Author: gre
|
||||
// License: MIT
|
||||
|
||||
const float size = 0.2;
|
||||
|
||||
float rand(vec2 co) {
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 p) {
|
||||
float r = rand(vec2(0, p.y));
|
||||
float m = smoothstep(0.0, -size, p.x*(1.0-size) + size*r - (progress * (1.0 + size)));
|
||||
return mix(getFromColor(p), getToColor(p), m);
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -1234,9 +1234,6 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_gl_renderer_new (),
|
||||
"OpenGL");
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_ngl_renderer_new (),
|
||||
"NGL");
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_vulkan_renderer_new (),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
```
|
||||
|
||||
@@ -66,8 +66,8 @@ The clock has several phases:
|
||||
- Layout
|
||||
- Paint
|
||||
|
||||
The phases happens in this order and we will always run each
|
||||
phase through before going back to the start.
|
||||
The phases happen in this order and all phases will always run
|
||||
through before going back to the start.
|
||||
|
||||
The Events phase is a stretch of time between each redraw where
|
||||
GTK processes input events from the user and other events
|
||||
|
||||
@@ -66,10 +66,6 @@ You can compile the program above with GCC using:
|
||||
gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs gtk4 )
|
||||
```
|
||||
|
||||
**Note**: If the above compilation does not work due to an error regarding `G_APPLICATION_DEFAULT_FLAGS`
|
||||
this could be due to your OS providing an older version of GLib. For GLib versions older than 2.74 you
|
||||
will need to replace `G_APPLICATION_DEFAULT_FLAGS` with `G_APPLICATION_FLAGS_NONE` in this example, and
|
||||
others in this documentation.
|
||||
For more information on how to compile a GTK application, please
|
||||
refer to the [Compiling GTK Applications](compiling.html)
|
||||
section in this reference.
|
||||
|
||||
@@ -380,13 +380,6 @@ does not support them.
|
||||
`base-instance`
|
||||
:GL_EXT_base_instance
|
||||
|
||||
### `GDK_VULKAN_DEVICE`
|
||||
|
||||
This variable can be set to the index of a Vulkan device to override
|
||||
the default selection of the device that is used for Vulkan rendering.
|
||||
The special value `list` can be used to obtain a list of all Vulkan
|
||||
devices.
|
||||
|
||||
### `GDK_VULKAN_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
@@ -400,15 +393,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
|
||||
|
||||
@@ -418,6 +402,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.
|
||||
|
||||
@@ -436,14 +423,8 @@ using and the GDK backend supports them:
|
||||
`cairo`
|
||||
: Selects the fallback Cairo renderer
|
||||
|
||||
`opengl`
|
||||
: Selects the default OpenGL renderer
|
||||
|
||||
`gl`
|
||||
: Selects the "gl" OpenGL renderer
|
||||
|
||||
`ngl`
|
||||
: Selects the "ngl" OpenGL renderer
|
||||
: Selects the OpenGL renderer
|
||||
|
||||
`vulkan`
|
||||
: Selects the Vulkan renderer
|
||||
|
||||
@@ -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` |
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ main (int argc,
|
||||
g_chdir (GTK_SRCDIR);
|
||||
#endif
|
||||
|
||||
GtkApplication *app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
GtkApplication *app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
|
||||
int status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ main (int argc,
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
||||
@@ -60,7 +60,7 @@ main (int argc,
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
||||
@@ -37,10 +37,8 @@ main (int argc,
|
||||
{
|
||||
GtkApplication *app;
|
||||
|
||||
app = gtk_application_new ("org.gtk.Example.GtkSearchBar",
|
||||
G_APPLICATION_FLAGS_NONE);
|
||||
g_signal_connect (app, "activate",
|
||||
G_CALLBACK (activate_cb), NULL);
|
||||
app = gtk_application_new ("org.gtk.Example.GtkSearchBar", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
return g_application_run (G_APPLICATION (app), argc, argv);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ main (int argc,
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
||||
@@ -111,7 +111,7 @@ gboolean broadway_server_surface_translate (BroadwayServer *
|
||||
int dx,
|
||||
int dy);
|
||||
guint32 broadway_server_upload_texture (BroadwayServer *server,
|
||||
GBytes *texture);
|
||||
GBytes *bytes);
|
||||
void broadway_server_release_texture (BroadwayServer *server,
|
||||
guint32 id);
|
||||
cairo_surface_t * broadway_server_create_surface (int width,
|
||||
|
||||
@@ -56,7 +56,7 @@ void _gdk_broadway_surface_translate (GdkSurface *surface,
|
||||
int dx,
|
||||
int dy);
|
||||
gboolean _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
|
||||
BroadwayInputMsg *msg);
|
||||
BroadwayInputMsg *event);
|
||||
gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
|
||||
GdkSurface *surface);
|
||||
void _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
void file_transfer_portal_register (void);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ 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.
|
||||
*/
|
||||
@@ -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.
|
||||
|
||||
@@ -79,6 +79,6 @@ gdk_cicp_equivalent (const GdkCicp *p1,
|
||||
return gdk_cicp_equal (&n1, &n2);
|
||||
}
|
||||
|
||||
const GdkCicp * gdk_cicp_params_get_cicp (GdkCicpParams *params);
|
||||
const GdkCicp * gdk_cicp_params_get_cicp (GdkCicpParams *self);
|
||||
|
||||
GdkCicpParams * gdk_cicp_params_new_for_cicp (const GdkCicp *cicp);
|
||||
|
||||
+8
-8
@@ -353,7 +353,7 @@ 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.
|
||||
*/
|
||||
@@ -366,7 +366,7 @@ 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.
|
||||
*/
|
||||
@@ -378,7 +378,7 @@ 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.
|
||||
*/
|
||||
@@ -390,7 +390,7 @@ 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.
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
* and tests, and must not include other headers.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <math.h>
|
||||
|
||||
static inline int
|
||||
sign (float v)
|
||||
{
|
||||
|
||||
+2
-7
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gdkcolorprivate.h"
|
||||
|
||||
#include "gdkcolorstateprivate.h"
|
||||
|
||||
|
||||
@@ -129,10 +131,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,11 +79,10 @@ void gdk_color_init_from_rgba (GdkColor *self,
|
||||
const GdkRGBA *rgba);
|
||||
void gdk_color_finish (GdkColor *self);
|
||||
|
||||
gboolean gdk_color_equal (const GdkColor *color1,
|
||||
const GdkColor *color2);
|
||||
gboolean gdk_color_equal (const GdkColor *self,
|
||||
const GdkColor *other);
|
||||
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,
|
||||
|
||||
@@ -78,7 +78,7 @@ extern GdkDefaultColorState gdk_default_color_states[GDK_COLOR_STATE_N_IDS];
|
||||
(GdkDefaultColorState *) (c) < &gdk_default_color_states[GDK_COLOR_STATE_N_IDS])
|
||||
#define GDK_DEFAULT_COLOR_STATE_ID(c) ((GdkColorStateId) (((GdkDefaultColorState *) c) - gdk_default_color_states))
|
||||
|
||||
const char * gdk_color_state_get_name (GdkColorState *color_state);
|
||||
const char * gdk_color_state_get_name (GdkColorState *self);
|
||||
GdkColorState * gdk_color_state_get_no_srgb_tf (GdkColorState *self);
|
||||
|
||||
GdkColorState * gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
|
||||
@@ -169,7 +169,7 @@ 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.
|
||||
*/
|
||||
@@ -181,7 +181,7 @@ 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.
|
||||
*/
|
||||
@@ -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
|
||||
|
||||
+8
-8
@@ -172,7 +172,7 @@ 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.
|
||||
*/
|
||||
@@ -184,7 +184,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
||||
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.
|
||||
*/
|
||||
@@ -196,7 +196,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
||||
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.
|
||||
*/
|
||||
@@ -208,7 +208,7 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkCursor:name: (attributes org.gtk.Property.get=gdk_cursor_get_name)
|
||||
* GdkCursor:name:
|
||||
*
|
||||
* Name of this this cursor.
|
||||
*
|
||||
@@ -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.
|
||||
|
||||
+28
-28
@@ -104,7 +104,7 @@ 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.
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*/
|
||||
@@ -125,7 +125,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:source: (attributes org.gtk.Property.get=gdk_device_get_source)
|
||||
* GdkDevice:source:
|
||||
*
|
||||
* Source type for the device.
|
||||
*/
|
||||
@@ -137,7 +137,7 @@ 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.
|
||||
*/
|
||||
@@ -159,7 +159,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -172,7 +172,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -185,7 +185,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:seat: (attributes org.gtk.Property.get=gdk_device_get_seat)
|
||||
* GdkDevice:seat:
|
||||
*
|
||||
* `GdkSeat` of this device.
|
||||
*/
|
||||
@@ -196,7 +196,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -211,7 +211,7 @@ 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.
|
||||
*/
|
||||
@@ -221,7 +221,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -233,7 +233,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -245,7 +245,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -257,7 +257,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -269,7 +269,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -281,7 +281,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -117,7 +117,7 @@ struct _GdkDeviceClass
|
||||
};
|
||||
|
||||
void _gdk_device_set_associated_device (GdkDevice *device,
|
||||
GdkDevice *relative);
|
||||
GdkDevice *associated);
|
||||
|
||||
void _gdk_device_reset_axes (GdkDevice *device);
|
||||
guint _gdk_device_add_axis (GdkDevice *device,
|
||||
|
||||
+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.
|
||||
|
||||
+26
-48
@@ -230,7 +230,7 @@ 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.
|
||||
*/
|
||||
@@ -240,7 +240,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -250,7 +250,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
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.
|
||||
*
|
||||
@@ -262,7 +262,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -272,7 +272,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
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
|
||||
*
|
||||
@@ -418,15 +418,17 @@ gdk_display_dispose (GObject *object)
|
||||
{
|
||||
GdkDisplay *display = GDK_DISPLAY (object);
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
gsize i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (display->dmabuf_downloaders); i++)
|
||||
if (display->vk_downloader)
|
||||
{
|
||||
if (display->dmabuf_downloaders[i] == NULL)
|
||||
continue;
|
||||
gdk_dmabuf_downloader_close (display->vk_downloader);
|
||||
g_clear_object (&display->vk_downloader);
|
||||
}
|
||||
|
||||
gdk_dmabuf_downloader_close (display->dmabuf_downloaders[i]);
|
||||
g_clear_object (&display->dmabuf_downloaders[i]);
|
||||
if (display->egl_downloader)
|
||||
{
|
||||
gdk_dmabuf_downloader_close (display->egl_downloader);
|
||||
g_clear_object (&display->egl_downloader);
|
||||
}
|
||||
|
||||
_gdk_display_manager_remove_display (gdk_display_manager_get (), display);
|
||||
@@ -434,7 +436,7 @@ gdk_display_dispose (GObject *object)
|
||||
g_queue_clear (&display->queued_events);
|
||||
|
||||
g_clear_pointer (&display->egl_dmabuf_formats, gdk_dmabuf_formats_unref);
|
||||
g_clear_pointer (&display->egl_external_formats, gdk_dmabuf_formats_unref);
|
||||
g_clear_pointer (&display->egl_internal_formats, gdk_dmabuf_formats_unref);
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
if (display->vk_dmabuf_formats)
|
||||
{
|
||||
@@ -1116,7 +1118,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.
|
||||
@@ -1965,33 +1967,6 @@ gdk_display_get_egl_display (GdkDisplay *self)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
static void
|
||||
gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
GdkDmabufDownloader *downloader)
|
||||
{
|
||||
gsize i;
|
||||
|
||||
if (downloader == NULL)
|
||||
return;
|
||||
|
||||
/* dmabuf_downloaders is NULL-terminated */
|
||||
for (i = 0; i < G_N_ELEMENTS (display->dmabuf_downloaders) - 1; i++)
|
||||
{
|
||||
if (display->dmabuf_downloaders[i] == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (i < G_N_ELEMENTS (display->dmabuf_downloaders) - 1);
|
||||
|
||||
display->dmabuf_downloaders[i] = downloader;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* To support a drm format, we must be able to import it into GL
|
||||
* using the relevant EGL extensions, and download it into a memory
|
||||
* texture, possibly doing format conversion with shaders (in GSK).
|
||||
*/
|
||||
void
|
||||
gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
{
|
||||
@@ -2009,22 +1984,25 @@ gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
if (gdk_has_feature (GDK_FEATURE_DMABUF))
|
||||
{
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_vulkan_get_dmabuf_downloader (self, builder));
|
||||
gdk_vulkan_init_dmabuf (self);
|
||||
if (self->vk_dmabuf_formats)
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, self->vk_dmabuf_formats);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_egl_downloader (self, builder));
|
||||
gdk_dmabuf_egl_init (self);
|
||||
if (self->egl_dmabuf_formats)
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, self->egl_dmabuf_formats);
|
||||
#endif
|
||||
|
||||
gdk_dmabuf_formats_builder_add_formats (builder,
|
||||
gdk_dmabuf_get_mmap_formats ());
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, gdk_dmabuf_get_mmap_formats ());
|
||||
}
|
||||
#endif
|
||||
|
||||
self->dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (builder);
|
||||
|
||||
GDK_DISPLAY_DEBUG (self, DMABUF,
|
||||
"Initialized support for %zu dmabuf formats",
|
||||
"Initialization finished. Advertising %zu dmabuf formats",
|
||||
gdk_dmabuf_formats_get_n_formats (self->dmabuf_formats));
|
||||
}
|
||||
|
||||
@@ -2075,7 +2053,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
|
||||
@@ -2120,7 +2098,7 @@ gdk_display_set_composited (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -2165,7 +2143,7 @@ gdk_display_set_rgba (GdkDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -149,7 +149,7 @@ 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.
|
||||
*/
|
||||
@@ -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`.
|
||||
|
||||
@@ -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 */
|
||||
@@ -131,11 +132,12 @@ struct _GdkDisplay
|
||||
guint have_egl_gl_colorspace : 1;
|
||||
|
||||
GdkDmabufFormats *dmabuf_formats;
|
||||
GdkDmabufDownloader *dmabuf_downloaders[4];
|
||||
GdkDmabufDownloader *egl_downloader;
|
||||
GdkDmabufDownloader *vk_downloader;
|
||||
|
||||
/* Cached data the EGL dmabuf downloader */
|
||||
GdkDmabufFormats *egl_dmabuf_formats;
|
||||
GdkDmabufFormats *egl_external_formats;
|
||||
GdkDmabufFormats *egl_internal_formats;
|
||||
};
|
||||
|
||||
struct _GdkDisplayClass
|
||||
@@ -238,15 +240,15 @@ GdkVulkanContext * gdk_display_create_vulkan_context (GdkDisplay *self,
|
||||
GdkSurface *surface,
|
||||
GError **error);
|
||||
|
||||
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
|
||||
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *self);
|
||||
|
||||
gboolean gdk_display_init_egl (GdkDisplay *display,
|
||||
gboolean gdk_display_init_egl (GdkDisplay *self,
|
||||
int /*EGLenum*/ platform,
|
||||
gpointer native_display,
|
||||
gboolean allow_any,
|
||||
GError **error);
|
||||
gpointer gdk_display_get_egl_display (GdkDisplay *display);
|
||||
gpointer gdk_display_get_egl_config (GdkDisplay *display,
|
||||
gpointer gdk_display_get_egl_display (GdkDisplay *self);
|
||||
gpointer gdk_display_get_egl_config (GdkDisplay *self,
|
||||
GdkMemoryDepth depth);
|
||||
|
||||
void gdk_display_set_rgba (GdkDisplay *display,
|
||||
@@ -287,7 +289,7 @@ void gdk_display_set_double_click_time (GdkDisplay *display,
|
||||
void gdk_display_set_double_click_distance (GdkDisplay *display,
|
||||
guint distance);
|
||||
void gdk_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *theme,
|
||||
const char *name,
|
||||
int size);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+32
-19
@@ -2068,7 +2068,7 @@ gdk_dmabuf_get_mmap_formats (void)
|
||||
continue;
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"mmap dmabuf format %.4s:%#0" G_GINT64_MODIFIER "x",
|
||||
"mmap advertises dmabuf format %.4s::%016" G_GINT64_MODIFIER "x",
|
||||
(char *) &supported_formats[i].fourcc, (guint64) DRM_FORMAT_MOD_LINEAR);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_format (builder,
|
||||
@@ -2082,7 +2082,7 @@ gdk_dmabuf_get_mmap_formats (void)
|
||||
return formats;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gdk_dmabuf_do_download_mmap (GdkTexture *texture,
|
||||
guchar *data,
|
||||
gsize stride)
|
||||
@@ -2093,16 +2093,17 @@ gdk_dmabuf_do_download_mmap (GdkTexture *texture,
|
||||
gsize sizes[GDK_DMABUF_MAX_PLANES];
|
||||
gsize needs_unmap[GDK_DMABUF_MAX_PLANES] = { FALSE, };
|
||||
gsize i, j;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
dmabuf = gdk_dmabuf_texture_get_dmabuf (GDK_DMABUF_TEXTURE (texture));
|
||||
|
||||
if (dmabuf->modifier != DRM_FORMAT_MOD_LINEAR)
|
||||
return FALSE;
|
||||
|
||||
info = get_drm_format_info (dmabuf->fourcc);
|
||||
|
||||
g_return_if_fail (info && info->download);
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_dmabuf_texture_get_display (GDK_DMABUF_TEXTURE (texture)), DMABUF,
|
||||
"Using mmap for downloading %dx%d dmabuf (format %.4s:%#" G_GINT64_MODIFIER "x)",
|
||||
gdk_texture_get_width (texture), gdk_texture_get_height (texture),
|
||||
(char *)&dmabuf->fourcc, dmabuf->modifier);
|
||||
if (!info || !info->download)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
@@ -2139,14 +2140,21 @@ gdk_dmabuf_do_download_mmap (GdkTexture *texture,
|
||||
needs_unmap[i] = TRUE;
|
||||
}
|
||||
|
||||
info->download (data,
|
||||
stride,
|
||||
gdk_texture_get_format (texture),
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
dmabuf,
|
||||
src_data,
|
||||
sizes);
|
||||
info->download (data,
|
||||
stride,
|
||||
gdk_texture_get_format (texture),
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
dmabuf,
|
||||
src_data,
|
||||
sizes);
|
||||
|
||||
retval = TRUE;
|
||||
|
||||
GDK_DISPLAY_DEBUG (gdk_dmabuf_texture_get_display (GDK_DMABUF_TEXTURE (texture)), DMABUF,
|
||||
"Used mmap for downloading %dx%d dmabuf (format %.4s:%#" G_GINT64_MODIFIER "x)",
|
||||
gdk_texture_get_width (texture), gdk_texture_get_height (texture),
|
||||
(char *)&dmabuf->fourcc, dmabuf->modifier);
|
||||
|
||||
out:
|
||||
for (i = 0; i < dmabuf->n_planes; i++)
|
||||
@@ -2159,9 +2167,11 @@ out:
|
||||
if (gdk_dmabuf_ioctl (dmabuf->planes[i].fd, DMA_BUF_IOCTL_SYNC, &(struct dma_buf_sync) { DMA_BUF_SYNC_END|DMA_BUF_SYNC_READ }) < 0)
|
||||
g_warning ("Failed to sync dmabuf: %s", g_strerror (errno));
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
GdkColorState *color_state,
|
||||
@@ -2170,10 +2180,11 @@ gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
{
|
||||
GdkMemoryFormat src_format = gdk_texture_get_format (texture);
|
||||
GdkColorState *src_color_state = gdk_texture_get_color_state (texture);
|
||||
gboolean retval;
|
||||
|
||||
if (format == src_format)
|
||||
{
|
||||
gdk_dmabuf_do_download_mmap (texture, data, stride);
|
||||
retval = gdk_dmabuf_do_download_mmap (texture, data, stride);
|
||||
gdk_memory_convert_color_state (data, stride, format,
|
||||
src_color_state, color_state,
|
||||
gdk_texture_get_width (texture),
|
||||
@@ -2191,7 +2202,7 @@ gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
src_stride = width * gdk_memory_format_bytes_per_pixel (src_format);
|
||||
src_data = g_new (guchar, src_stride * height);
|
||||
|
||||
gdk_dmabuf_do_download_mmap (texture, src_data, src_stride);
|
||||
retval = gdk_dmabuf_do_download_mmap (texture, src_data, src_stride);
|
||||
|
||||
gdk_memory_convert (data, stride, format, color_state,
|
||||
src_data, src_stride, src_format, src_color_state,
|
||||
@@ -2199,6 +2210,8 @@ gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
|
||||
g_free (src_data);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -19,19 +19,6 @@ gdk_dmabuf_downloader_close (GdkDmabufDownloader *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_dmabuf_downloader_supports (GdkDmabufDownloader *self,
|
||||
GdkDmabufTexture *texture,
|
||||
GError **error)
|
||||
{
|
||||
GdkDmabufDownloaderInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DMABUF_DOWNLOADER (self), FALSE);
|
||||
|
||||
iface = GDK_DMABUF_DOWNLOADER_GET_IFACE (self);
|
||||
return iface->supports (self, texture, error);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dmabuf_downloader_download (GdkDmabufDownloader *self,
|
||||
GdkDmabufTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
@@ -41,9 +28,8 @@ gdk_dmabuf_downloader_download (GdkDmabufDownloader *self,
|
||||
{
|
||||
GdkDmabufDownloaderInterface *iface;
|
||||
|
||||
g_return_if_fail (GDK_IS_DMABUF_DOWNLOADER (self));
|
||||
g_return_val_if_fail (GDK_IS_DMABUF_DOWNLOADER (self), FALSE);
|
||||
|
||||
iface = GDK_DMABUF_DOWNLOADER_GET_IFACE (self);
|
||||
iface->download (self, texture, format, color_state, data, stride);
|
||||
return iface->download (self, texture, format, color_state, data, stride);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ struct _GdkDmabufDownloaderInterface
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void (* close) (GdkDmabufDownloader *downloader);
|
||||
gboolean (* supports) (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GError **error);
|
||||
void (* download) (GdkDmabufDownloader *downloader,
|
||||
gboolean (* download) (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
GdkColorState *color_state,
|
||||
@@ -25,11 +22,8 @@ struct _GdkDmabufDownloaderInterface
|
||||
gsize stride);
|
||||
};
|
||||
|
||||
void gdk_dmabuf_downloader_close (GdkDmabufDownloader *downloader);
|
||||
gboolean gdk_dmabuf_downloader_supports (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GError **error);
|
||||
void gdk_dmabuf_downloader_download (GdkDmabufDownloader *downloader,
|
||||
void gdk_dmabuf_downloader_close (GdkDmabufDownloader *self);
|
||||
gboolean gdk_dmabuf_downloader_download (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
GdkColorState *color_state,
|
||||
|
||||
+100
-92
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
@@ -32,6 +31,8 @@
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
|
||||
/* A dmabuf downloader implementation that downloads buffers via
|
||||
* gsk_renderer_render_texture + GL texture download.
|
||||
*/
|
||||
@@ -39,7 +40,7 @@
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_collect_formats (GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *formats,
|
||||
GdkDmabufFormatsBuilder *external)
|
||||
GdkDmabufFormatsBuilder *internal)
|
||||
{
|
||||
GdkGLContext *context = gdk_display_get_gl_context (display);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
@@ -60,8 +61,8 @@ gdk_dmabuf_egl_downloader_collect_formats (GdkDisplay *display,
|
||||
eglQueryDmaBufFormatsEXT (egl_display, num_fourccs, fourccs, &num_fourccs);
|
||||
|
||||
n_mods = 80;
|
||||
modifiers = g_new (guint64, n_mods);
|
||||
external_only = g_new (unsigned int, n_mods);
|
||||
modifiers = g_new0 (guint64, n_mods);
|
||||
external_only = g_new0 (unsigned int, n_mods);
|
||||
|
||||
for (int i = 0; i < num_fourccs; i++)
|
||||
{
|
||||
@@ -93,24 +94,27 @@ gdk_dmabuf_egl_downloader_collect_formats (GdkDisplay *display,
|
||||
|
||||
for (int j = 0; j < num_modifiers; j++)
|
||||
{
|
||||
/* All linear formats we support are already added my the mmap downloader.
|
||||
/* All linear formats we support are already advertised by the mmap downloader.
|
||||
* We don't add external formats, unless we can use them (via GLES)
|
||||
*/
|
||||
if (modifiers[j] != DRM_FORMAT_MOD_LINEAR &&
|
||||
(!external_only[j] || gdk_gl_context_get_use_es (context)))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"%s EGL dmabuf format %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
external_only[j] ? "external " : "",
|
||||
(char *) &fourccs[i],
|
||||
modifiers[j]);
|
||||
gboolean advertise = modifiers[j] != DRM_FORMAT_MOD_LINEAR &&
|
||||
(!external_only[j] || gdk_gl_context_get_use_es (context));
|
||||
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], modifiers[j]);
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"EGL %s %sdmabuf format %.4s::%016" G_GINT64_MODIFIER "x",
|
||||
advertise ? "advertises" : "supports",
|
||||
external_only[j] ? "external " : "",
|
||||
(char *) &fourccs[i],
|
||||
modifiers[j]);
|
||||
|
||||
if (advertise)
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], modifiers[j]);
|
||||
|
||||
if (!external_only[j])
|
||||
{
|
||||
gdk_dmabuf_formats_builder_add_format (internal, fourccs[i], modifiers[j]);
|
||||
all_external = FALSE;
|
||||
}
|
||||
if (external_only[j])
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], modifiers[j]);
|
||||
else
|
||||
all_external = FALSE;
|
||||
}
|
||||
|
||||
/* Accept implicit modifiers as long as we accept the format at all.
|
||||
@@ -122,8 +126,8 @@ gdk_dmabuf_egl_downloader_collect_formats (GdkDisplay *display,
|
||||
*/
|
||||
if (!all_external || gdk_gl_context_get_use_es (context))
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
if (all_external)
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
if (!all_external)
|
||||
gdk_dmabuf_formats_builder_add_format (internal, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
}
|
||||
|
||||
g_free (modifiers);
|
||||
@@ -133,77 +137,6 @@ gdk_dmabuf_egl_downloader_collect_formats (GdkDisplay *display,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Hack. We don't include gsk/gsk.h here to avoid a build order problem
|
||||
* with the generated header gskenumtypes.h, so we need to hack around
|
||||
* a bit to access the gsk api we need.
|
||||
*/
|
||||
|
||||
typedef struct _GskRenderer GskRenderer;
|
||||
|
||||
extern GskRenderer * gsk_gl_renderer_new (void);
|
||||
extern gboolean gsk_renderer_realize_for_display (GskRenderer *renderer,
|
||||
GdkDisplay *display,
|
||||
GError **error);
|
||||
|
||||
GdkDmabufDownloader *
|
||||
gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
{
|
||||
GdkDmabufFormatsBuilder *formats;
|
||||
GdkDmabufFormatsBuilder *external;
|
||||
gboolean retval = FALSE;
|
||||
GError *error = NULL;
|
||||
GskRenderer *renderer;
|
||||
GdkGLContext *previous;
|
||||
|
||||
g_assert (display->egl_dmabuf_formats == NULL);
|
||||
g_assert (display->egl_external_formats == NULL);
|
||||
|
||||
if (!gdk_display_prepare_gl (display, NULL))
|
||||
return NULL;
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
if (previous)
|
||||
g_object_ref (previous);
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
retval = gdk_dmabuf_egl_downloader_collect_formats (display, formats, external);
|
||||
|
||||
display->egl_dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (formats);
|
||||
display->egl_external_formats = gdk_dmabuf_formats_builder_free_to_formats (external);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||
|
||||
if (!retval)
|
||||
{
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
if (!gsk_renderer_realize_for_display (renderer, display, &error))
|
||||
{
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (previous)
|
||||
{
|
||||
gdk_gl_context_make_current (previous);
|
||||
g_object_unref (previous);
|
||||
}
|
||||
|
||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||
}
|
||||
|
||||
EGLImage
|
||||
gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
int width,
|
||||
@@ -283,10 +216,85 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Creating EGLImage for dmabuf failed: %#x",
|
||||
eglGetError ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
#endif /* HAVE_DMABUF && HAVE_EGL */
|
||||
|
||||
/* Hack. We don't include gsk/gsk.h here to avoid a build order problem
|
||||
* with the generated header gskenumtypes.h, so we need to hack around
|
||||
* a bit to access the gsk api we need.
|
||||
*/
|
||||
|
||||
typedef struct _GskRenderer GskRenderer;
|
||||
|
||||
extern GskRenderer * gsk_gl_renderer_new (void);
|
||||
extern gboolean gsk_renderer_realize_for_display (GskRenderer *renderer,
|
||||
GdkDisplay *display,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
gdk_dmabuf_egl_init (GdkDisplay *display)
|
||||
{
|
||||
#if defined (HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
GdkDmabufFormatsBuilder *formats;
|
||||
GdkDmabufFormatsBuilder *internal;
|
||||
gboolean retval = FALSE;
|
||||
GError *error = NULL;
|
||||
GskRenderer *renderer;
|
||||
GdkGLContext *previous;
|
||||
|
||||
if (display->egl_dmabuf_formats != NULL)
|
||||
return;
|
||||
|
||||
if (!gdk_has_feature (GDK_FEATURE_DMABUF) ||
|
||||
!gdk_display_prepare_gl (display, NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
internal = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
if (previous)
|
||||
g_object_ref (previous);
|
||||
|
||||
retval = gdk_dmabuf_egl_downloader_collect_formats (display, formats, internal);
|
||||
|
||||
display->egl_dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (formats);
|
||||
display->egl_internal_formats = gdk_dmabuf_formats_builder_free_to_formats (internal);
|
||||
|
||||
if (!retval)
|
||||
{
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
return;
|
||||
}
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
if (!gsk_renderer_realize_for_display (renderer, display, &error))
|
||||
{
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (previous)
|
||||
{
|
||||
gdk_gl_context_make_current (previous);
|
||||
g_object_unref (previous);
|
||||
}
|
||||
|
||||
display->egl_downloader = GDK_DMABUF_DOWNLOADER (renderer);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdmabufdownloaderprivate.h"
|
||||
|
||||
#include <epoxy/egl.h>
|
||||
|
||||
GdkDmabufDownloader * gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder);
|
||||
EGLImage gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
int width,
|
||||
int height,
|
||||
@@ -16,3 +14,5 @@ EGLImage gdk_dmabuf_egl_create_image (GdkDisplay
|
||||
int target);
|
||||
|
||||
#endif /* HAVE_DMABUF && HAVE_EGL */
|
||||
|
||||
void gdk_dmabuf_egl_init (GdkDisplay *display);
|
||||
|
||||
@@ -27,7 +27,7 @@ void gdk_dmabuf_close_fds (GdkDmabuf
|
||||
#ifdef HAVE_DMABUF
|
||||
|
||||
GdkDmabufFormats * gdk_dmabuf_get_mmap_formats (void) G_GNUC_CONST;
|
||||
void gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
gboolean gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
GdkColorState *color_state,
|
||||
guchar *data,
|
||||
|
||||
+49
-43
@@ -50,7 +50,6 @@ struct _GdkDmabufTexture
|
||||
GdkTexture parent_instance;
|
||||
|
||||
GdkDisplay *display;
|
||||
GdkDmabufDownloader *downloader;
|
||||
|
||||
GdkDmabuf dmabuf;
|
||||
|
||||
@@ -85,7 +84,6 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
||||
self->destroy = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&self->downloader);
|
||||
g_clear_object (&self->display);
|
||||
|
||||
G_OBJECT_CLASS (gdk_dmabuf_texture_parent_class)->dispose (object);
|
||||
@@ -107,16 +105,49 @@ static gboolean
|
||||
gdk_dmabuf_texture_invoke_callback (gpointer data)
|
||||
{
|
||||
Download *download = data;
|
||||
GdkDisplay *display = download->texture->display;
|
||||
|
||||
gdk_dmabuf_downloader_download (download->texture->downloader,
|
||||
download->texture,
|
||||
download->format,
|
||||
download->color_state,
|
||||
download->data,
|
||||
download->stride);
|
||||
if (display->egl_downloader &&
|
||||
gdk_dmabuf_downloader_download (display->egl_downloader,
|
||||
download->texture,
|
||||
download->format,
|
||||
download->color_state,
|
||||
download->data,
|
||||
download->stride))
|
||||
{
|
||||
/* Successfully downloaded using EGL */
|
||||
}
|
||||
else if (display->vk_downloader &&
|
||||
gdk_dmabuf_downloader_download (display->vk_downloader,
|
||||
download->texture,
|
||||
download->format,
|
||||
download->color_state,
|
||||
download->data,
|
||||
download->stride))
|
||||
{
|
||||
/* Successfully downloaded using Vulkan */
|
||||
}
|
||||
#ifdef HAVE_DMABUF
|
||||
else if (gdk_dmabuf_download_mmap (GDK_TEXTURE (download->texture),
|
||||
download->format,
|
||||
download->color_state,
|
||||
download->data,
|
||||
download->stride))
|
||||
{
|
||||
/* Successfully downloaded using mmap */
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
const GdkDmabuf *dmabuf = gdk_dmabuf_texture_get_dmabuf (download->texture);
|
||||
|
||||
g_critical ("Failed to download %dx%d dmabuf texture (format %.4s:%#" G_GINT64_MODIFIER "x)",
|
||||
gdk_texture_get_width (GDK_TEXTURE (download->texture)),
|
||||
gdk_texture_get_height (GDK_TEXTURE (download->texture)),
|
||||
(char *)&(dmabuf->fourcc), dmabuf->modifier);
|
||||
}
|
||||
|
||||
g_atomic_int_set (&download->spinlock, 1);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -130,14 +161,6 @@ gdk_dmabuf_texture_download (GdkTexture *texture,
|
||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (texture);
|
||||
Download download = { self, format, color_state, data, stride, 0 };
|
||||
|
||||
if (self->downloader == NULL)
|
||||
{
|
||||
#ifdef HAVE_DMABUF
|
||||
gdk_dmabuf_download_mmap (texture, format, color_state, data, stride);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
g_main_context_invoke (NULL, gdk_dmabuf_texture_invoke_callback, &download);
|
||||
|
||||
while (g_atomic_int_get (&download.spinlock) == 0);
|
||||
@@ -183,10 +206,8 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
GdkDisplay *display;
|
||||
GdkDmabuf dmabuf;
|
||||
GdkColorState *color_state;
|
||||
GError *local_error = NULL;
|
||||
int width, height;
|
||||
gboolean premultiplied;
|
||||
gsize i;
|
||||
|
||||
display = gdk_dmabuf_texture_builder_get_display (builder);
|
||||
width = gdk_dmabuf_texture_builder_get_width (builder);
|
||||
@@ -234,37 +255,22 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
: GDK_MEMORY_R8G8B8A8;
|
||||
}
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (gdk_dmabuf_get_mmap_formats (), dmabuf.fourcc, dmabuf.modifier))
|
||||
if (!gdk_dmabuf_formats_contains (display->dmabuf_formats, dmabuf.fourcc, dmabuf.modifier))
|
||||
{
|
||||
for (i = 0; display->dmabuf_downloaders[i] != NULL; i++)
|
||||
{
|
||||
if (local_error && g_error_matches (local_error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT))
|
||||
g_clear_error (&local_error);
|
||||
|
||||
if (gdk_dmabuf_downloader_supports (display->dmabuf_downloaders[i],
|
||||
self,
|
||||
local_error ? NULL : &local_error))
|
||||
{
|
||||
self->downloader = g_object_ref (display->dmabuf_downloaders[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->downloader == NULL)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
g_object_unref (self);
|
||||
return NULL;
|
||||
}
|
||||
g_set_error (error,
|
||||
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT,
|
||||
"Unsupported dmabuf format: %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
(char *) &dmabuf.fourcc, dmabuf.modifier);
|
||||
g_object_unref (self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Creating dmabuf texture, format %.4s:%#" G_GINT64_MODIFIER "x, %s%u planes, memory format %u, downloader %s",
|
||||
"Creating dmabuf texture, format %.4s:%#" G_GINT64_MODIFIER "x, %s%u planes, memory format %u",
|
||||
(char *) &dmabuf.fourcc, dmabuf.modifier,
|
||||
gdk_dmabuf_texture_builder_get_premultiplied (builder) ? " premultiplied, " : "",
|
||||
dmabuf.n_planes,
|
||||
GDK_TEXTURE (self)->format,
|
||||
self->downloader ? G_OBJECT_TYPE_NAME (self->downloader) : "none");
|
||||
GDK_TEXTURE (self)->format);
|
||||
|
||||
/* Set this only once we know that the texture will be created.
|
||||
* Otherwise dispose() will run the callback */
|
||||
|
||||
@@ -272,7 +272,7 @@ 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.
|
||||
*
|
||||
@@ -284,7 +284,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -296,7 +296,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -308,7 +308,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -346,7 +346,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -373,7 +373,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
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].
|
||||
*
|
||||
@@ -385,7 +385,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -471,7 +471,7 @@ gdk_dmabuf_texture_builder_set_display (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -515,7 +515,7 @@ gdk_dmabuf_texture_builder_set_width (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -559,7 +559,7 @@ gdk_dmabuf_texture_builder_set_height (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -648,7 +648,7 @@ gdk_dmabuf_texture_builder_set_modifier (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -710,7 +710,7 @@ gdk_dmabuf_texture_builder_set_premultiplied (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -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.
|
||||
*
|
||||
@@ -920,7 +920,7 @@ gdk_dmabuf_texture_builder_set_color_state (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -962,7 +962,7 @@ gdk_dmabuf_texture_builder_set_update_texture (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self);
|
||||
|
||||
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *builder,
|
||||
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
|
||||
const GdkDmabuf *dmabuf);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+14
-14
@@ -92,7 +92,7 @@ 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.
|
||||
@@ -362,7 +362,7 @@ 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`.
|
||||
*/
|
||||
@@ -375,7 +375,7 @@ 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.
|
||||
*/
|
||||
@@ -388,7 +388,7 @@ 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.
|
||||
*/
|
||||
@@ -400,7 +400,7 @@ 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.
|
||||
*/
|
||||
@@ -413,7 +413,7 @@ 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.
|
||||
*/
|
||||
@@ -426,7 +426,7 @@ 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.
|
||||
*/
|
||||
@@ -439,7 +439,7 @@ 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.
|
||||
*/
|
||||
|
||||
@@ -172,7 +172,7 @@ 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`.
|
||||
*/
|
||||
@@ -184,7 +184,7 @@ 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.
|
||||
*/
|
||||
@@ -251,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
|
||||
@@ -269,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.
|
||||
@@ -511,9 +511,9 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
* Use `GskRenderNode` and `GskRenderer`.
|
||||
*/
|
||||
const cairo_region_t *
|
||||
_gdk_draw_context_get_frame_region (GdkDrawContext *context)
|
||||
_gdk_draw_context_get_frame_region (GdkDrawContext *self)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (self);
|
||||
|
||||
return priv->frame_region;
|
||||
}
|
||||
|
||||
+12
-12
@@ -320,7 +320,7 @@ 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
|
||||
*/
|
||||
@@ -334,7 +334,7 @@ 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
|
||||
*/
|
||||
@@ -347,7 +347,7 @@ 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.
|
||||
*/
|
||||
@@ -359,7 +359,7 @@ 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
|
||||
*/
|
||||
@@ -372,7 +372,7 @@ 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.
|
||||
*/
|
||||
@@ -385,7 +385,7 @@ 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
|
||||
*/
|
||||
@@ -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`.
|
||||
@@ -528,7 +528,7 @@ gdk_drop_set_actions (GdkDrop *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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`
|
||||
|
||||
-11
@@ -82,7 +82,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
cairo_surface_t *image;
|
||||
guint framebuffer;
|
||||
int alpha_size = 0;
|
||||
int major, minor, version;
|
||||
gboolean es_use_bgra = FALSE;
|
||||
|
||||
paint_context = gdk_surface_get_paint_gl_context (surface, NULL);
|
||||
@@ -118,16 +117,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_gl_context_get_version (paint_context, &major, &minor);
|
||||
version = major * 100 + minor;
|
||||
|
||||
/* TODO: Use glTexSubImage2D() and do a row-by-row copy to replace
|
||||
* the GL_UNPACK_ROW_LENGTH support
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (paint_context) &&
|
||||
!(version >= 300 || gdk_gl_context_has_feature (paint_context, GDK_GL_FEATURE_UNPACK_SUBIMAGE)))
|
||||
return;
|
||||
|
||||
/* TODO: avoid reading back non-required data due to dest clip */
|
||||
image = cairo_surface_create_similar_image (cairo_get_target (cr),
|
||||
(alpha_size == 0) ? CAIRO_FORMAT_RGB24 : CAIRO_FORMAT_ARGB32,
|
||||
|
||||
+374
-162
@@ -105,9 +105,6 @@
|
||||
|
||||
static const GdkDebugKey gdk_gl_feature_keys[] = {
|
||||
{ "debug", GDK_GL_FEATURE_DEBUG, "GL_KHR_debug" },
|
||||
{ "unpack-subimage", GDK_GL_FEATURE_UNPACK_SUBIMAGE, "GL_EXT_unpack_subimage" },
|
||||
{ "half-float", GDK_GL_FEATURE_VERTEX_HALF_FLOAT, "GL_OES_vertex_half_float" },
|
||||
{ "sync", GDK_GL_FEATURE_SYNC, "GL_ARB_sync" },
|
||||
{ "base-instance", GDK_GL_FEATURE_BASE_INSTANCE, "GL_ARB_base_instance" },
|
||||
{ "buffer-storage", GDK_GL_FEATURE_BUFFER_STORAGE, "GL_EXT_buffer_storage" },
|
||||
};
|
||||
@@ -764,7 +761,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
|
||||
*
|
||||
@@ -783,7 +780,7 @@ 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.
|
||||
*
|
||||
@@ -798,7 +795,7 @@ 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.
|
||||
*
|
||||
@@ -1060,16 +1057,9 @@ gdk_gl_context_get_matching_version (GdkGLContext *context,
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
if (api == GDK_GL_API_GL)
|
||||
{
|
||||
if (legacy)
|
||||
min_version = GDK_GL_MIN_GL_LEGACY_VERSION;
|
||||
else
|
||||
min_version = GDK_GL_MIN_GL_VERSION;
|
||||
}
|
||||
min_version = GDK_GL_MIN_GL_VERSION;
|
||||
else
|
||||
{
|
||||
min_version = GDK_GL_MIN_GLES_VERSION;
|
||||
}
|
||||
min_version = GDK_GL_MIN_GLES_VERSION;
|
||||
|
||||
if (gdk_gl_version_greater_equal (&priv->required, &min_version))
|
||||
*out_version = priv->required;
|
||||
@@ -1250,7 +1240,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
|
||||
*
|
||||
@@ -1281,7 +1271,7 @@ gdk_gl_context_set_allowed_apis (GdkGLContext *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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().
|
||||
@@ -1301,7 +1291,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.
|
||||
@@ -1592,38 +1582,35 @@ gdk_gl_context_init_memory_flags (GdkGLContext *self)
|
||||
priv->memory_flags[GDK_MEMORY_G8A8] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
#endif
|
||||
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
/* GLES 3.0.6 spec, table 3.13 */
|
||||
priv->memory_flags[GDK_MEMORY_G8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
|
||||
/* no changes in GLES 3.1 spec, table 8.13 */
|
||||
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
{
|
||||
/* GLES 3.0.6 spec, table 3.13 */
|
||||
priv->memory_flags[GDK_MEMORY_G8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
|
||||
/* no changes in GLES 3.1 spec, table 8.13 */
|
||||
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
{
|
||||
/* GLES 3.2 spec, table 8.10 */
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
}
|
||||
/* GLES 3.2 spec, table 8.10 */
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= GDK_GL_FORMAT_RENDERABLE;
|
||||
}
|
||||
|
||||
if (epoxy_has_gl_extension ("GL_OES_rgb8_rgba8"))
|
||||
@@ -1631,64 +1618,55 @@ gdk_gl_context_init_memory_flags (GdkGLContext *self)
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_EXT_abgr"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_A8B8G8R8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A8B8G8R8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
priv->memory_flags[GDK_MEMORY_X8B8G8R8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_X8B8G8R8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
|
||||
/* Technically, those extensions are supported on GLES2.
|
||||
* However, GTK uses the wrong format/type pairs with them, so we don't enable them.
|
||||
*/
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
if (epoxy_has_gl_extension ("GL_EXT_texture_norm16"))
|
||||
{
|
||||
if (epoxy_has_gl_extension ("GL_EXT_texture_norm16"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16A16_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_half_float"))
|
||||
{
|
||||
GdkGLMemoryFlags flags = GDK_GL_FORMAT_USABLE;
|
||||
if (epoxy_has_gl_extension ("GL_EXT_color_buffer_half_float"))
|
||||
flags |= GDK_GL_FORMAT_RENDERABLE;
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_half_float_linear"))
|
||||
flags |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= flags;
|
||||
/* disabled for now, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/10378 */
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16_FLOAT] |= flags & ~GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= flags;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_float"))
|
||||
{
|
||||
GdkGLMemoryFlags flags = GDK_GL_FORMAT_USABLE;
|
||||
if (epoxy_has_gl_extension ("GL_EXT_color_buffer_float"))
|
||||
flags |= GDK_GL_FORMAT_RENDERABLE;
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_float_linear"))
|
||||
flags |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32_FLOAT] |= flags & ~GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= flags;
|
||||
}
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16A16_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_half_float"))
|
||||
{
|
||||
GdkGLMemoryFlags flags = GDK_GL_FORMAT_USABLE;
|
||||
if (epoxy_has_gl_extension ("GL_EXT_color_buffer_half_float"))
|
||||
flags |= GDK_GL_FORMAT_RENDERABLE;
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_half_float_linear"))
|
||||
flags |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= flags;
|
||||
/* disabled for now, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/10378 */
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16_FLOAT] |= flags & ~GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= flags;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_float"))
|
||||
{
|
||||
GdkGLMemoryFlags flags = GDK_GL_FORMAT_USABLE;
|
||||
if (epoxy_has_gl_extension ("GL_EXT_color_buffer_float"))
|
||||
flags |= GDK_GL_FORMAT_RENDERABLE;
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_float_linear"))
|
||||
flags |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32_FLOAT] |= flags & ~GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= flags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1703,32 +1681,11 @@ gdk_gl_version_init_epoxy (GdkGLVersion *version)
|
||||
static GdkGLFeatures
|
||||
gdk_gl_context_check_features (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkGLFeatures features = 0;
|
||||
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
|
||||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage"))
|
||||
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
|
||||
}
|
||||
|
||||
if (epoxy_has_gl_extension ("GL_KHR_debug"))
|
||||
features |= GDK_GL_FEATURE_DEBUG;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float"))
|
||||
features |= GDK_GL_FEATURE_VERTEX_HALF_FLOAT;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync"))
|
||||
features |= GDK_GL_FEATURE_SYNC;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "4.2", "9.9") ||
|
||||
epoxy_has_gl_extension ("GL_EXT_base_instance") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_base_instance"))
|
||||
@@ -1913,7 +1870,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.
|
||||
@@ -2037,8 +1994,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;
|
||||
@@ -2049,11 +2009,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2205,6 +2174,7 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
|
||||
g_assert (the_gl_backend_type == backend_type);
|
||||
}
|
||||
|
||||
#if defined(HAVE_EGL) && defined(HAVE_DMABUF)
|
||||
static guint
|
||||
gdk_gl_context_import_dmabuf_for_target (GdkGLContext *self,
|
||||
int width,
|
||||
@@ -2212,7 +2182,6 @@ gdk_gl_context_import_dmabuf_for_target (GdkGLContext *self,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target)
|
||||
{
|
||||
#if defined(HAVE_EGL) && defined(HAVE_DMABUF)
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
EGLImage image;
|
||||
guint texture_id;
|
||||
@@ -2234,10 +2203,8 @@ gdk_gl_context_import_dmabuf_for_target (GdkGLContext *self,
|
||||
eglDestroyImageKHR (gdk_display_get_egl_display (display), image);
|
||||
|
||||
return texture_id;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
guint
|
||||
gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
@@ -2246,64 +2213,32 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean *external)
|
||||
{
|
||||
#if defined(HAVE_EGL) && defined(HAVE_DMABUF)
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
guint texture_id;
|
||||
|
||||
gdk_display_init_dmabuf (display);
|
||||
gdk_dmabuf_egl_init (display);
|
||||
|
||||
if (gdk_dmabuf_formats_contains (display->egl_dmabuf_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
if (gdk_dmabuf_formats_contains (display->egl_internal_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
/* This is the path for modern drivers that support modifiers */
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_2D);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = FALSE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_EXTERNAL_OES);
|
||||
GL_TEXTURE_2D);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
"Import of %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = TRUE;
|
||||
*external = FALSE;
|
||||
return texture_id;
|
||||
}
|
||||
else
|
||||
@@ -2340,6 +2275,9 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
*external = target == GL_TEXTURE_EXTERNAL_OES;
|
||||
return texture_id;
|
||||
}
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -2457,3 +2395,277 @@ out:
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_gl_context_find_format (GdkGLContext *self,
|
||||
GdkMemoryAlpha alpha,
|
||||
GLint gl_format,
|
||||
GLint gl_type,
|
||||
GdkMemoryFormat *out_format)
|
||||
{
|
||||
GdkMemoryFormat format;
|
||||
|
||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||
{
|
||||
GLint q_internal_format, q_internal_srgb_format;
|
||||
GLenum q_format, q_type;
|
||||
GLint q_swizzle[4];
|
||||
|
||||
if (gdk_memory_format_alpha (format) != alpha)
|
||||
continue;
|
||||
|
||||
if (!(gdk_gl_context_get_format_flags (self, format) & GDK_GL_FORMAT_RENDERABLE))
|
||||
continue;
|
||||
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (self),
|
||||
&q_internal_format,
|
||||
&q_internal_srgb_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
continue;
|
||||
|
||||
*out_format = format;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gl_context_download (GdkGLContext *self,
|
||||
GLuint tex_id,
|
||||
GdkMemoryFormat tex_format,
|
||||
GdkColorState *tex_color_state,
|
||||
guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
GdkMemoryFormat dest_format,
|
||||
GdkColorState *dest_color_state,
|
||||
gsize width,
|
||||
gsize height)
|
||||
{
|
||||
gsize expected_stride;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
GLenum gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
|
||||
expected_stride = width * gdk_memory_format_bytes_per_pixel (dest_format);
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self) &&
|
||||
((gdk_gl_context_get_format_flags (self, tex_format) & GDK_GL_FORMAT_USABLE) == GDK_GL_FORMAT_USABLE))
|
||||
{
|
||||
gdk_memory_format_gl_format (tex_format,
|
||||
gdk_gl_context_get_use_es (self),
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (dest_stride == expected_stride &&
|
||||
dest_format == tex_format)
|
||||
{
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
dest_data);
|
||||
|
||||
gdk_memory_convert_color_state (dest_data,
|
||||
dest_stride,
|
||||
dest_format,
|
||||
dest_color_state,
|
||||
tex_color_state,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsize stride = width * gdk_memory_format_bytes_per_pixel (tex_format);
|
||||
guchar *pixels = g_malloc_n (stride, height);
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
pixels);
|
||||
|
||||
gdk_memory_convert (dest_data,
|
||||
dest_stride,
|
||||
dest_format,
|
||||
dest_color_state,
|
||||
pixels,
|
||||
stride,
|
||||
tex_format,
|
||||
tex_color_state,
|
||||
width,
|
||||
height);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkMemoryFormat actual_format;
|
||||
GLenum gl_read_format, gl_read_type;
|
||||
GLuint fbo;
|
||||
|
||||
glGenFramebuffers (1, &fbo);
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, fbo);
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex_id, 0);
|
||||
if (gdk_gl_context_check_version (self, "4.3", "3.1"))
|
||||
{
|
||||
GLint read_format, read_type;
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format);
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type);
|
||||
if (gdk_gl_context_find_format (self, gdk_memory_format_alpha (tex_format), read_format, read_type, &actual_format))
|
||||
{
|
||||
gl_read_format = read_format;
|
||||
gl_read_type = read_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (tex_format, FALSE));
|
||||
if (gdk_memory_format_alpha (tex_format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (self),
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (tex_format, FALSE));
|
||||
if (gdk_memory_format_alpha (tex_format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (self),
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
||||
if (dest_format == actual_format &&
|
||||
(dest_stride == expected_stride))
|
||||
{
|
||||
glReadPixels (0, 0,
|
||||
width, height,
|
||||
gl_read_format,
|
||||
gl_read_type,
|
||||
dest_data);
|
||||
|
||||
gdk_memory_convert_color_state (dest_data,
|
||||
dest_stride,
|
||||
dest_format,
|
||||
dest_color_state,
|
||||
tex_color_state,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsize actual_bpp = gdk_memory_format_bytes_per_pixel (actual_format);
|
||||
gsize stride = actual_bpp * width;
|
||||
guchar *pixels = g_malloc_n (stride, height);
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels (0, 0,
|
||||
width, height,
|
||||
gl_read_format,
|
||||
gl_read_type,
|
||||
pixels);
|
||||
|
||||
/* Fix up gles inadequacies */
|
||||
|
||||
if (gl_read_format == GL_RGBA &&
|
||||
gl_read_type == GL_UNSIGNED_BYTE &&
|
||||
(tex_format == GDK_MEMORY_G8A8 ||
|
||||
tex_format == GDK_MEMORY_G8A8_PREMULTIPLIED ||
|
||||
tex_format == GDK_MEMORY_G8 ||
|
||||
tex_format == GDK_MEMORY_A8))
|
||||
{
|
||||
for (unsigned int y = 0; y < height; y++)
|
||||
{
|
||||
for (unsigned int x = 0; x < width; x++)
|
||||
{
|
||||
guchar *data = &pixels[y * stride + x * actual_bpp];
|
||||
if (tex_format == GDK_MEMORY_G8A8 ||
|
||||
tex_format == GDK_MEMORY_G8A8_PREMULTIPLIED)
|
||||
{
|
||||
data[3] = data[1];
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
}
|
||||
else if (tex_format == GDK_MEMORY_G8)
|
||||
{
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
data[3] = 0xff;
|
||||
}
|
||||
else if (tex_format == GDK_MEMORY_A8)
|
||||
{
|
||||
data[3] = data[0];
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_read_format == GL_RGBA &&
|
||||
gl_read_type == GL_UNSIGNED_SHORT &&
|
||||
(tex_format == GDK_MEMORY_G16A16 ||
|
||||
tex_format == GDK_MEMORY_G16A16_PREMULTIPLIED ||
|
||||
tex_format == GDK_MEMORY_G16 ||
|
||||
tex_format == GDK_MEMORY_A16))
|
||||
{
|
||||
for (unsigned int y = 0; y < height; y++)
|
||||
{
|
||||
for (unsigned int x = 0; x < width; x++)
|
||||
{
|
||||
guint16 *data = (guint16 *) &pixels[y * stride + x * actual_bpp];
|
||||
if (tex_format == GDK_MEMORY_G16A16 ||
|
||||
tex_format == GDK_MEMORY_G16A16_PREMULTIPLIED)
|
||||
{
|
||||
data[3] = data[1];
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
}
|
||||
else if (tex_format == GDK_MEMORY_G16)
|
||||
{
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
data[3] = 0xffff;
|
||||
}
|
||||
else if (tex_format == GDK_MEMORY_A16)
|
||||
{
|
||||
data[3] = data[0];
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdk_memory_convert (dest_data,
|
||||
dest_stride,
|
||||
dest_format,
|
||||
dest_color_state,
|
||||
pixels,
|
||||
stride,
|
||||
actual_format,
|
||||
tex_color_state,
|
||||
width,
|
||||
height);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
glDeleteFramebuffers (1, &fbo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,8 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_FEATURE_DEBUG = 1 << 0,
|
||||
GDK_GL_FEATURE_UNPACK_SUBIMAGE = 1 << 1,
|
||||
GDK_GL_FEATURE_VERTEX_HALF_FLOAT = 1 << 2,
|
||||
GDK_GL_FEATURE_SYNC = 1 << 3,
|
||||
GDK_GL_FEATURE_BASE_INSTANCE = 1 << 4,
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE = 1 << 5,
|
||||
GDK_GL_FEATURE_BASE_INSTANCE = 1 << 1,
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE = 1 << 2,
|
||||
} GdkGLFeatures;
|
||||
|
||||
typedef enum {
|
||||
@@ -120,7 +117,7 @@ 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,
|
||||
@@ -133,16 +130,16 @@ void gdk_gl_context_set_version (GdkGLContext
|
||||
const GdkGLVersion *version);
|
||||
void gdk_gl_context_set_is_legacy (GdkGLContext *context,
|
||||
gboolean is_legacy);
|
||||
gboolean gdk_gl_context_check_gl_version (GdkGLContext *context,
|
||||
gboolean gdk_gl_context_check_gl_version (GdkGLContext *self,
|
||||
const GdkGLVersion *gl_version,
|
||||
const GdkGLVersion *gles_version);
|
||||
|
||||
static inline gboolean
|
||||
gdk_gl_context_check_version (GdkGLContext *context,
|
||||
gdk_gl_context_check_version (GdkGLContext *self,
|
||||
const char *gl_version,
|
||||
const char *gles_version)
|
||||
{
|
||||
return gdk_gl_context_check_gl_version (context,
|
||||
return gdk_gl_context_check_gl_version (self,
|
||||
gl_version ? &GDK_GL_VERSION_STRING (gl_version) : NULL,
|
||||
gles_version ? &GDK_GL_VERSION_STRING (gles_version) : NULL);
|
||||
}
|
||||
@@ -181,6 +178,17 @@ gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
void gdk_gl_context_download (GdkGLContext *self,
|
||||
GLuint tex_id,
|
||||
GdkMemoryFormat tex_format,
|
||||
GdkColorState *tex_color_state,
|
||||
guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
GdkMemoryFormat dest_format,
|
||||
GdkColorState *dest_color_state,
|
||||
gsize width,
|
||||
gsize height);
|
||||
|
||||
guint gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
|
||||
+24
-266
@@ -101,6 +101,10 @@ gdk_gl_texture_invoke_callback (gpointer data)
|
||||
context = gdk_display_get_gl_context (gdk_gl_context_get_display (invoke->self->context));
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
|
||||
if (previous)
|
||||
g_object_ref (previous);
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (invoke->self->sync && context != invoke->self->context)
|
||||
@@ -113,9 +117,14 @@ gdk_gl_texture_invoke_callback (gpointer data)
|
||||
g_atomic_int_set (&invoke->spinlock, 1);
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
{
|
||||
gdk_gl_context_make_current (previous);
|
||||
g_object_unref (previous);
|
||||
}
|
||||
else
|
||||
gdk_gl_context_clear_current ();
|
||||
{
|
||||
gdk_gl_context_clear_current ();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -142,276 +151,26 @@ struct _Download
|
||||
gsize stride;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
GdkMemoryAlpha alpha,
|
||||
GLint gl_format,
|
||||
GLint gl_type,
|
||||
GdkMemoryFormat *out_format)
|
||||
{
|
||||
GdkMemoryFormat format;
|
||||
|
||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||
{
|
||||
GLint q_internal_format, q_internal_srgb_format;
|
||||
GLenum q_format, q_type;
|
||||
GLint q_swizzle[4];
|
||||
|
||||
if (gdk_memory_format_alpha (format) != alpha)
|
||||
continue;
|
||||
|
||||
if (!(gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_RENDERABLE))
|
||||
continue;
|
||||
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&q_internal_format,
|
||||
&q_internal_srgb_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
continue;
|
||||
|
||||
*out_format = format;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
GdkGLContext *context,
|
||||
gpointer download_)
|
||||
{
|
||||
GdkTexture *texture = GDK_TEXTURE (self);
|
||||
GdkMemoryFormat format;
|
||||
gsize expected_stride;
|
||||
Download *download = download_;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
GLenum gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
|
||||
format = gdk_texture_get_format (texture),
|
||||
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
||||
|
||||
if (!gdk_gl_context_get_use_es (context) &&
|
||||
((gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_USABLE) == GDK_GL_FORMAT_USABLE))
|
||||
{
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (download->stride == expected_stride &&
|
||||
download->format == format)
|
||||
{
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
download->data);
|
||||
|
||||
gdk_memory_convert_color_state (download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
download->color_state,
|
||||
texture->color_state,
|
||||
texture->width,
|
||||
texture->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsize stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
|
||||
guchar *pixels = g_malloc_n (stride, texture->height);
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
glGetTexImage (GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_format,
|
||||
gl_type,
|
||||
pixels);
|
||||
|
||||
gdk_memory_convert (download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
download->color_state,
|
||||
pixels,
|
||||
stride,
|
||||
format,
|
||||
texture->color_state,
|
||||
texture->width,
|
||||
texture->height);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkMemoryFormat actual_format;
|
||||
GLenum gl_read_format, gl_read_type;
|
||||
GLuint fbo;
|
||||
|
||||
glGenFramebuffers (1, &fbo);
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, fbo);
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
||||
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
||||
{
|
||||
GLint read_format, read_type;
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format);
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type);
|
||||
if (gdk_gl_texture_find_format (context, gdk_memory_format_alpha (format), read_format, read_type, &actual_format))
|
||||
{
|
||||
gl_read_format = read_format;
|
||||
gl_read_type = read_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (format, FALSE));
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (format, FALSE));
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
||||
if (download->format == actual_format &&
|
||||
(download->stride == expected_stride))
|
||||
{
|
||||
glReadPixels (0, 0,
|
||||
texture->width, texture->height,
|
||||
gl_read_format,
|
||||
gl_read_type,
|
||||
download->data);
|
||||
|
||||
gdk_memory_convert_color_state (download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
download->color_state,
|
||||
texture->color_state,
|
||||
texture->width,
|
||||
texture->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsize actual_bpp = gdk_memory_format_bytes_per_pixel (actual_format);
|
||||
gsize stride = actual_bpp * texture->width;
|
||||
guchar *pixels = g_malloc_n (stride, texture->height);
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels (0, 0,
|
||||
texture->width, texture->height,
|
||||
gl_read_format,
|
||||
gl_read_type,
|
||||
pixels);
|
||||
|
||||
/* Fix up gles inadequacies */
|
||||
|
||||
if (gl_read_format == GL_RGBA &&
|
||||
gl_read_type == GL_UNSIGNED_BYTE &&
|
||||
(format == GDK_MEMORY_G8A8 ||
|
||||
format == GDK_MEMORY_G8A8_PREMULTIPLIED ||
|
||||
format == GDK_MEMORY_G8 ||
|
||||
format == GDK_MEMORY_A8))
|
||||
{
|
||||
for (unsigned int y = 0; y < texture->height; y++)
|
||||
{
|
||||
for (unsigned int x = 0; x < texture->width; x++)
|
||||
{
|
||||
guchar *data = &pixels[y * stride + x * actual_bpp];
|
||||
if (format == GDK_MEMORY_G8A8 ||
|
||||
format == GDK_MEMORY_G8A8_PREMULTIPLIED)
|
||||
{
|
||||
data[3] = data[1];
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
}
|
||||
else if (format == GDK_MEMORY_G8)
|
||||
{
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
data[3] = 0xff;
|
||||
}
|
||||
else if (format == GDK_MEMORY_A8)
|
||||
{
|
||||
data[3] = data[0];
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_read_format == GL_RGBA &&
|
||||
gl_read_type == GL_UNSIGNED_SHORT &&
|
||||
(format == GDK_MEMORY_G16A16 ||
|
||||
format == GDK_MEMORY_G16A16_PREMULTIPLIED ||
|
||||
format == GDK_MEMORY_G16 ||
|
||||
format == GDK_MEMORY_A16))
|
||||
{
|
||||
for (unsigned int y = 0; y < texture->height; y++)
|
||||
{
|
||||
for (unsigned int x = 0; x < texture->width; x++)
|
||||
{
|
||||
guint16 *data = (guint16 *) &pixels[y * stride + x * actual_bpp];
|
||||
if (format == GDK_MEMORY_G16A16 ||
|
||||
format == GDK_MEMORY_G16A16_PREMULTIPLIED)
|
||||
{
|
||||
data[3] = data[1];
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
}
|
||||
else if (format == GDK_MEMORY_G16)
|
||||
{
|
||||
data[1] = data[0];
|
||||
data[2] = data[0];
|
||||
data[3] = 0xffff;
|
||||
}
|
||||
else if (format == GDK_MEMORY_A16)
|
||||
{
|
||||
data[3] = data[0];
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdk_memory_convert (download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
download->color_state,
|
||||
pixels,
|
||||
stride,
|
||||
actual_format,
|
||||
texture->color_state,
|
||||
texture->width,
|
||||
texture->height);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
glDeleteFramebuffers (1, &fbo);
|
||||
}
|
||||
gdk_gl_context_download (context,
|
||||
gdk_gl_texture_get_id (self),
|
||||
gdk_texture_get_format (texture),
|
||||
gdk_texture_get_color_state (texture),
|
||||
download->data,
|
||||
download->stride,
|
||||
download->format,
|
||||
download->color_state,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gdk_gl_texture_download (GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
@@ -518,8 +277,7 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
|
||||
self->id = gdk_gl_texture_builder_get_id (builder);
|
||||
GDK_TEXTURE (self)->format = gdk_gl_texture_builder_get_format (builder);
|
||||
self->has_mipmap = gdk_gl_texture_builder_get_has_mipmap (builder);
|
||||
if (gdk_gl_context_has_feature (self->context, GDK_GL_FEATURE_SYNC))
|
||||
self->sync = gdk_gl_texture_builder_get_sync (builder);
|
||||
self->sync = gdk_gl_texture_builder_get_sync (builder);
|
||||
self->destroy = destroy;
|
||||
self->data = data;
|
||||
|
||||
|
||||
+29
-29
@@ -225,7 +225,7 @@ 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.
|
||||
*
|
||||
@@ -237,7 +237,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -250,7 +250,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -262,7 +262,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -274,7 +274,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -286,7 +286,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -311,7 +311,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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].
|
||||
*
|
||||
@@ -323,7 +323,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -335,7 +335,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
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.
|
||||
*
|
||||
@@ -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
|
||||
*
|
||||
@@ -416,7 +416,7 @@ gdk_gl_texture_builder_set_context (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -460,7 +460,7 @@ gdk_gl_texture_builder_set_height (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -506,7 +506,7 @@ gdk_gl_texture_builder_set_id (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -550,7 +550,7 @@ gdk_gl_texture_builder_set_width (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -594,7 +594,7 @@ gdk_gl_texture_builder_set_has_mipmap (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -642,7 +642,7 @@ gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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`
|
||||
*
|
||||
@@ -687,7 +687,7 @@ gdk_gl_texture_builder_set_color_state (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -743,7 +743,7 @@ gdk_gl_texture_builder_set_format (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -785,7 +785,7 @@ gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -33,13 +33,9 @@ G_BEGIN_DECLS
|
||||
|
||||
/* Minimum OpenGL versions supported by GTK.
|
||||
* Backends should make sure to never create a context of a previous version.
|
||||
*
|
||||
* The macros refer to OpenGL; OpenGL with OPENGL_COMPATIBILITY_PROFILE_BIT as
|
||||
* OPENGL_PROFILE_MASK; and OpenGL ES respectively
|
||||
*/
|
||||
#define GDK_GL_MIN_GL_VERSION GDK_GL_VERSION_INIT (3, 2)
|
||||
#define GDK_GL_MIN_GL_LEGACY_VERSION GDK_GL_VERSION_INIT (3, 0)
|
||||
#define GDK_GL_MIN_GLES_VERSION GDK_GL_VERSION_INIT (2, 0)
|
||||
#define GDK_GL_MIN_GL_VERSION GDK_GL_VERSION_INIT (3, 3)
|
||||
#define GDK_GL_MIN_GLES_VERSION GDK_GL_VERSION_INIT (3, 0)
|
||||
|
||||
typedef struct _GdkGLVersion GdkGLVersion;
|
||||
|
||||
@@ -60,9 +56,6 @@ static const GdkGLVersion supported_gl_versions[] = {
|
||||
GDK_GL_VERSION_INIT (4, 1),
|
||||
GDK_GL_VERSION_INIT (4, 0),
|
||||
GDK_GL_VERSION_INIT (3, 3),
|
||||
GDK_GL_VERSION_INIT (3, 2),
|
||||
GDK_GL_VERSION_INIT (3, 1),
|
||||
GDK_GL_VERSION_INIT (3, 0),
|
||||
|
||||
GDK_GL_VERSION_INIT (0, 0)
|
||||
};
|
||||
@@ -71,7 +64,6 @@ static const GdkGLVersion supported_gles_versions[] = {
|
||||
GDK_GL_VERSION_INIT (3, 2),
|
||||
GDK_GL_VERSION_INIT (3, 1),
|
||||
GDK_GL_VERSION_INIT (3, 0),
|
||||
GDK_GL_VERSION_INIT (2, 0),
|
||||
|
||||
GDK_GL_VERSION_INIT (0, 0)
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+643
-172
File diff suppressed because it is too large
Load Diff
@@ -96,11 +96,11 @@ const char * gdk_memory_format_get_name (GdkMemoryFormat
|
||||
void gdk_memory_convert (guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
GdkMemoryFormat dest_format,
|
||||
GdkColorState *src_cs,
|
||||
GdkColorState *dest_cs,
|
||||
const guchar *src_data,
|
||||
gsize src_stride,
|
||||
GdkMemoryFormat src_format,
|
||||
GdkColorState *dest_cs,
|
||||
GdkColorState *src_cs,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void gdk_memory_convert_color_state (guchar *data,
|
||||
@@ -110,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
|
||||
|
||||
@@ -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
|
||||
*
|
||||
@@ -377,7 +377,7 @@ gdk_memory_texture_builder_set_bytes (GdkMemoryTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -425,7 +425,7 @@ gdk_memory_texture_builder_set_color_state (GdkMemoryTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -469,7 +469,7 @@ gdk_memory_texture_builder_set_height (GdkMemoryTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -512,7 +512,6 @@ gdk_memory_texture_builder_set_width (GdkMemoryTextureBuilder *self,
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[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`
|
||||
@@ -558,7 +556,7 @@ gdk_memory_texture_builder_set_stride (GdkMemoryTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -601,7 +599,7 @@ gdk_memory_texture_builder_set_format (GdkMemoryTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -644,7 +642,7 @@ gdk_memory_texture_builder_set_update_texture (GdkMemoryTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
+26
-26
@@ -187,7 +187,7 @@ 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.
|
||||
*
|
||||
@@ -199,7 +199,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -209,7 +209,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -219,7 +219,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:model: (attributes org.gtk.Property.get=gdk_monitor_get_model)
|
||||
* GdkMonitor:model:
|
||||
*
|
||||
* The model name.
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:connector: (attributes org.gtk.Property.get=gdk_monitor_get_connector)
|
||||
* GdkMonitor:connector:
|
||||
*
|
||||
* The connector name.
|
||||
*/
|
||||
@@ -239,7 +239,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*
|
||||
@@ -253,7 +253,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*
|
||||
@@ -265,7 +265,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -275,7 +275,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -286,7 +286,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -297,7 +297,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -308,7 +308,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -319,7 +319,7 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
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.
|
||||
*/
|
||||
@@ -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
|
||||
@@ -696,7 +696,7 @@ gdk_monitor_invalidate (GdkMonitor *monitor)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -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 ();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user